{"id":27969815,"url":"https://github.com/cmliu/asn2cidrs","last_synced_at":"2025-05-07T21:54:45.767Z","repository":{"id":212636577,"uuid":"731960901","full_name":"cmliu/ASN2CIDRs","owner":"cmliu","description":"ASN号获取IP段","archived":false,"fork":false,"pushed_at":"2025-01-05T19:24:14.000Z","size":24,"stargazers_count":30,"open_issues_count":0,"forks_count":35,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T21:54:41.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://as.090227.xyz","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmliu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-15T09:44:39.000Z","updated_at":"2025-04-03T08:48:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7e8ada8-20ed-42ef-9fb4-a764e1d511fd","html_url":"https://github.com/cmliu/ASN2CIDRs","commit_stats":null,"previous_names":["cmliu/asn2ipv4cidrs","cmliu/asn2cidrs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmliu%2FASN2CIDRs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmliu%2FASN2CIDRs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmliu%2FASN2CIDRs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmliu%2FASN2CIDRs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmliu","download_url":"https://codeload.github.com/cmliu/ASN2CIDRs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252961845,"owners_count":21832193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-07T21:54:45.165Z","updated_at":"2025-05-07T21:54:45.756Z","avatar_url":"https://github.com/cmliu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ASN to CIDRs\n\n该 Worker 脚本旨在处理请求并从 GitHub 仓库 `ipverse/asn-ip` 返回的 JSON 数据中提取基于提供的自治系统号（ASN）的 IPv4 和 IPv6 CIDR（无类别域间路由）。\n\n## 安装\n\n创建一个新的 Cloudflare Worker。然后，你可以把 `_worker.js` 的代码复制到你的 Worker 的脚本编辑器里。\n\n## 使用\n\n访问你的 Worker 的 URL，并在地址后面加上你想要查询的 ASN 号。\n例如，如果你的 Worker 的网址是 `as.090227.xyz`，你可以访问：\n\n- 直接访问 `as.090227.xyz`，你会得到当前访问的IP；\n---\n### 1. 返回 IPv4 的 CIDR\n```url\nhttps://as.090227.xyz/AS45102\n```\n\n这将返回 AS45102 的 IPv4 CIDR 列表。\n```\n5.181.224.0/23\n8.208.0.0/16\n8.209.0.0/19\n8.209.36.0/22\n8.209.40.0/21\n8.209.48.0/20\n8.209.64.0/18\n...\n```\n---\n### 2. 返回 IPv6 的 CIDR\n```url\nhttps://as.090227.xyz/AS45102?6\n```\n\n这将返回 AS45102 的 IPv4 CIDR 列表。\n```\n2400:3200::/48\n2400:3200:baba::/48\n2400:b200:4100::/46\n2401:b180:4100::/48\n2404:2280:1000::/36\n2404:2280:2000::/35\n2404:2280:4000::/36\n2408:4000:1000::/48\n2408:4009:500::/48\n...\n```\n---\n### 3. 返回所有格式的 CIDR\n```url\nhttps://as.090227.xyz/AS45102?4\u00266\n或\nhttps://as.090227.xyz/AS45102?all\n```\n\n这将返回 AS45102 的 IPv4 CIDR 列表。\n```\n5.181.224.0/23\n8.208.0.0/16\n8.209.0.0/19\n8.209.36.0/22\n8.209.40.0/21\n8.209.48.0/20\n8.209.64.0/18\n2400:3200::/48\n2400:3200:baba::/48\n2400:b200:4100::/46\n2401:b180:4100::/48\n2404:2280:1000::/36\n2404:2280:2000::/35\n2404:2280:4000::/36\n2408:4000:1000::/48\n2408:4009:500::/48\n...\n```\n---\n### 4. 返回 CIDR 的 json\n```url\nhttps://as.090227.xyz/AS45102.json\n```\n\n这将返回 AS45102 的 json 内容。\n```json\n{\n    \"asn\": 45102,\n    \"handle\": \"ALIBABA-CN-NET\",\n    \"description\": \"Alibaba (US) Technology Co., Ltd.\",\n    \"subnets\": {\n        \"ipv4\": [\n            \"5.181.224.0/23\",\n            \"8.208.0.0/16\",\n            \"8.209.0.0/19\",\n            \"8.209.36.0/22\",\n            \"8.209.40.0/21\",\n            \"8.209.48.0/20\",\n            \"8.209.64.0/18\",\n            \"...\"\n        ],\n        \"ipv6\": [\n            \"2400:3200::/48\",\n            \"2400:3200:baba::/48\",\n            \"2400:b200:4100::/46\",\n            \"2401:b180:4100::/48\",\n            \"2404:2280:1000::/36\",\n            \"2404:2280:2000::/35\",\n            \"2404:2280:4000::/36\",\n            \"...\"\n        ]\n    }\n}\n```\n\n## 实际应用方式\n\n你可以使用 `wget` 命令将结果保存到文件中：\n\n```bash\nwget -O ip.txt https://as.090227.xyz/AS45102\n```\n\n## 感谢\n\n[ipverse](https://github.com/ipverse/asn-ip)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmliu%2Fasn2cidrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmliu%2Fasn2cidrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmliu%2Fasn2cidrs/lists"}