{"id":34741810,"url":"https://github.com/compassvpn/prefix-fetcher","last_synced_at":"2026-04-23T05:04:40.038Z","repository":{"id":289189709,"uuid":"970222632","full_name":"compassvpn/prefix-fetcher","owner":"compassvpn","description":"Prefix Fetcher","archived":false,"fork":false,"pushed_at":"2026-04-09T02:51:36.000Z","size":370,"stargazers_count":56,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-09T04:29:58.957Z","etag":null,"topics":["china","ip","iran","prefix","range"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compassvpn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-21T17:14:14.000Z","updated_at":"2026-04-06T12:25:45.000Z","dependencies_parsed_at":"2025-05-29T02:39:25.314Z","dependency_job_id":"125aa35d-b3d8-47a0-83a6-77973833c6c9","html_url":"https://github.com/compassvpn/prefix-fetcher","commit_stats":null,"previous_names":["compassvpn/ir-access","compassvpn/prefix-fetcher"],"tags_count":281,"template":false,"template_full_name":null,"purl":"pkg:github/compassvpn/prefix-fetcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compassvpn%2Fprefix-fetcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compassvpn%2Fprefix-fetcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compassvpn%2Fprefix-fetcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compassvpn%2Fprefix-fetcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compassvpn","download_url":"https://codeload.github.com/compassvpn/prefix-fetcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compassvpn%2Fprefix-fetcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32166661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T02:19:40.750Z","status":"ssl_error","status_checked_at":"2026-04-23T02:17:55.737Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["china","ip","iran","prefix","range"],"created_at":"2025-12-25T04:16:30.423Z","updated_at":"2026-04-23T05:04:40.017Z","avatar_url":"https://github.com/compassvpn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prefix Fetcher\n\n**Prefix Fetcher** is a Go-based tool for fetching country-specific IP prefixes from BGP data. Dynamically fetches ASN lists from Regional Internet Registry (RIR) delegated files and filters BGP prefixes accordingly.\n\n## Features\n\n- **Dynamic ASN Fetching**: Automatically downloads the latest ASN allocations from RIR delegated files\n  - Iran (IR): Uses RIPE NCC delegated data\n  - China (CN): Uses APNIC delegated data\n  - Russia (RU): Uses RIPE NCC delegated data\n- **Comprehensive Coverage**: Fetches from all RIRs for complete ASN discovery\n- **BGP Data**: Fetches IP prefixes from [bgp.tools](https://bgp.tools/table.jsonl)\n- **IPv4 /24 Blocks**: Converts IPv4 prefixes to /24 blocks for efficient processing\n- **IPv6 Preservation**: Keeps IPv6 prefixes in their original format\n- **Clean \u0026 Simple**: No caching, fresh data on every run\n- **Automatic retry logic** with exponential backoff\n- **Duplicate removal**: Automatically deduplicates ASNs found across multiple RIRs\n\n## Prerequisites\n\n- **Go (\u003e=1.24)**\n\n## Build\n\n1. Clone the repository:\n\n    ```sh\n    git clone https://github.com/compassvpn/prefix-fetcher.git\n    cd prefix-fetcher\n    ```\n\n2. Build the application:\n\n    ```sh\n    go build -o prefix-fetcher\n    ```\n\n## Usage\n\n```sh\n./prefix-fetcher [OPTIONS]\n```\n\n### Available Options\n\n| Option        | Description                                    |\n|---------------|------------------------------------------------|\n| `--fetch-ir`  | Fetch Iranian IP prefixes                      |\n| `--fetch-cn`  | Fetch Chinese IP prefixes                      |\n| `--fetch-ru`  | Fetch Russian IP prefixes                      |\n| `-h, --help`  | Show help information                          |\n\n### Examples\n\n- Fetch Iranian IP prefixes:\n\n  ```sh\n  ./prefix-fetcher --fetch-ir\n  ```\n\n- Fetch Chinese IP prefixes:\n\n  ```sh\n  ./prefix-fetcher --fetch-cn\n  ```\n\n- Fetch Russian IP prefixes:\n\n  ```sh\n  ./prefix-fetcher --fetch-ru\n  ```\n\n- Fetch multiple countries:\n\n  ```sh\n  ./prefix-fetcher --fetch-ir --fetch-cn --fetch-ru\n  ```\n\n- Show help:\n\n  ```sh\n  ./prefix-fetcher --help\n  ```\n\n## Output Files\n\nThe tool generates country-specific prefix files:\n\n**Iranian prefixes:**\n- `ir_prefixes_v4.txt` - IPv4 prefixes as /24 blocks\n- `ir_prefixes_v6.txt` - IPv6 prefixes\n\n**Chinese prefixes:**\n- `cn_prefixes_v4.txt` - IPv4 prefixes as /24 blocks  \n- `cn_prefixes_v6.txt` - IPv6 prefixes\n\n**Russian prefixes:**\n- `ru_prefixes_v4.txt` - IPv4 prefixes as /24 blocks\n- `ru_prefixes_v6.txt` - IPv6 prefixes\n\n## How It Works\n\n1. **Fetches ASN Lists**: Downloads the latest ASN allocations from all RIRs for comprehensive coverage:\n   - **Iran**: Primary coverage from RIPE NCC, with additional checks across all RIRs\n   - **China**: Primary coverage from APNIC, with additional checks across all RIRs\n   - **Russia**: Primary coverage from RIPE NCC, with additional checks across all RIRs\n2. **Downloads BGP Data**: Fetches the complete BGP routing table from bgp.tools\n3. **Filters by ASN**: Keeps only prefixes from the dynamically fetched ASN lists\n4. **Processes IPv4**: Converts IPv4 prefixes to /24 blocks for consistency\n5. **Sorts and Saves**: Outputs clean, sorted prefix lists to text files\n\n## Data Sources\n\n- **RIR Delegated Files**: \n  - Iran: [RIPE NCC](https://ftp.ripe.net/ripe/stats/delegated-ripencc-latest) (+ all other RIRs)\n  - China: [APNIC](https://ftp.apnic.net/stats/apnic/delegated-apnic-latest) (+ all other RIRs)\n  - Russia: [RIPE NCC](https://ftp.ripe.net/ripe/stats/delegated-ripencc-latest) (+ all other RIRs)\n- **BGP Data**: [bgp.tools](https://bgp.tools/table.jsonl)\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Contributions\n\nContributions are welcome! Feel free to fork the repository and submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompassvpn%2Fprefix-fetcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompassvpn%2Fprefix-fetcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompassvpn%2Fprefix-fetcher/lists"}