{"id":13712152,"url":"https://github.com/v2fly/geoip","last_synced_at":"2026-01-22T06:31:47.256Z","repository":{"id":37963557,"uuid":"281846679","full_name":"v2fly/geoip","owner":"v2fly","description":"GeoIP for V2Ray. Generate and release GeoIP files such as geoip.dat and geoip-only-cn-private.dat for V2Ray automatically monthly.","archived":false,"fork":false,"pushed_at":"2025-05-05T01:47:02.000Z","size":12681,"stargazers_count":726,"open_issues_count":0,"forks_count":123,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-05-05T02:34:33.969Z","etag":null,"topics":["geoip","geolite2","geolite2-country","ipv4","ipv6","maxmind","routing","v2fly","v2ray","v2ray-core"],"latest_commit_sha":null,"homepage":"https://www.v2fly.org","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/v2fly.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}},"created_at":"2020-07-23T04:04:03.000Z","updated_at":"2025-05-03T09:55:44.000Z","dependencies_parsed_at":"2023-11-23T01:41:14.819Z","dependency_job_id":"9654f71e-1413-47d3-bcb3-a9f991da26f5","html_url":"https://github.com/v2fly/geoip","commit_stats":null,"previous_names":[],"tags_count":308,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v2fly%2Fgeoip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v2fly%2Fgeoip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v2fly%2Fgeoip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v2fly%2Fgeoip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/v2fly","download_url":"https://codeload.github.com/v2fly/geoip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252772353,"owners_count":21801912,"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":["geoip","geolite2","geolite2-country","ipv4","ipv6","maxmind","routing","v2fly","v2ray","v2ray-core"],"created_at":"2024-08-02T23:01:15.386Z","updated_at":"2026-01-05T04:06:10.132Z","avatar_url":"https://github.com/v2fly.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# GeoIP for V2Ray\n\nThis project releases GeoIP files monthly for routing purpose in Project V. It also provides a command line interface(CLI) tool for users to customize their own GeoIP files.\n\n## Download links\n\nFor all GeoIP files released by this project, see the [release branch](https://github.com/v2fly/geoip/tree/release). Below are download URLs for some GeoIP files:\n\n- **geoip.dat**：\n  - [https://github.com/v2fly/geoip/releases/latest/download/geoip.dat](https://github.com/v2fly/geoip/releases/latest/download/geoip.dat)\n  - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip.dat](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip.dat)\n- **geoip.dat.sha256sum**：\n  - [https://github.com/v2fly/geoip/releases/latest/download/geoip.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/geoip.dat.sha256sum)\n  - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip.dat.sha256sum](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip.dat.sha256sum)\n- **geoip-only-cn-private.dat**：\n  - [https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat](https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat)\n  - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip-only-cn-private.dat](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip-only-cn-private.dat)\n- **geoip-only-cn-private.dat.sha256sum**：\n  - [https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat.sha256sum)\n  - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip-only-cn-private.dat.sha256sum](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/geoip-only-cn-private.dat.sha256sum)\n- **cn.dat**：\n  - [https://github.com/v2fly/geoip/releases/latest/download/cn.dat](https://github.com/v2fly/geoip/releases/latest/download/cn.dat)\n  - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/cn.dat](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/cn.dat)\n- **cn.dat.sha256sum**：\n  - [https://github.com/v2fly/geoip/releases/latest/download/cn.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/cn.dat.sha256sum)\n  - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/cn.dat.sha256sum](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/cn.dat.sha256sum)\n- **private.dat**：\n  - [https://github.com/v2fly/geoip/releases/latest/download/private.dat](https://github.com/v2fly/geoip/releases/latest/download/private.dat)\n  - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/private.dat](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/private.dat)\n- **private.dat.sha256sum**：\n  - [https://github.com/v2fly/geoip/releases/latest/download/private.dat.sha256sum](https://github.com/v2fly/geoip/releases/latest/download/private.dat.sha256sum)\n  - [https://cdn.jsdelivr.net/gh/v2fly/geoip@release/private.dat.sha256sum](https://cdn.jsdelivr.net/gh/v2fly/geoip@release/private.dat.sha256sum)\n\n## GeoIP usage example in V2Ray\n\n```json\n\"routing\": {\n  \"rules\": [\n    {\n      \"type\": \"field\",\n      \"outboundTag\": \"Direct\",\n      \"ip\": [\n        \"223.5.5.5/32\",\n        \"119.29.29.29/32\",\n        \"180.76.76.76/32\",\n        \"114.114.114.114/32\",\n        \"geoip:cn\",\n        \"geoip:private\",\n        \"ext:cn.dat:cn\",\n        \"ext:private.dat:private\",\n        \"ext:geoip-only-cn-private.dat:cn\",\n        \"ext:geoip-only-cn-private.dat:private\"\n      ]\n    },\n    {\n      \"type\": \"field\",\n      \"outboundTag\": \"Proxy-1\",\n      \"ip\": [\n        \"1.1.1.1/32\",\n        \"1.0.0.1/32\",\n        \"8.8.8.8/32\",\n        \"8.8.4.4/32\"\n      ]\n    },\n    {\n      \"type\": \"field\",\n      \"outboundTag\": \"Proxy-2\",\n      \"ip\": [\n        \"geoip:us\",\n        \"geoip:ca\"\n      ]\n    },\n    {\n      \"type\": \"field\",\n      \"outboundTag\": \"Proxy-3\",\n      \"ip\": [\n        \"geoip:hk\",\n        \"geoip:mo\",\n        \"geoip:tw\",\n        \"geoip:jp\",\n        \"geoip:sg\"\n      ]\n    }\n  ]\n}\n```\n\n## Customize GeoIP files\n\n### Concept explanation\n\nThese two concepts are notable: `input` and `output`. The `input` is the data source and its input format, whereas the `output` is the destination of the converted data and its output format. What the CLI does is to aggregate all input format data, then convert them to output format and write them to GeoIP files by using the options in the config file.\n\n### Supported formats\n\nSupported `input` formats:\n\n- **cutter**: Remove data from previous steps\n- **maxmindGeoLite2CountryCSV**: Convert MaxMind GeoLite2 country CSV data to other formats\n- **maxmindMMDB**: Convert MaxMind country mmdb database to other formats\n- **dbipCountryMMDB**: Convert DB-IP lite country mmdb database to other formats\n- **private**: Convert LAN and private network CIDR to other formats\n- **text**: Convert plaintext IP and CIDR to other formats\n- **v2rayGeoIPDat**: Convert V2Ray GeoIP dat to other formats\n\nSupported `output` formats:\n\n- **text**: Convert data to plaintext CIDR format\n- **v2rayGeoIPDat**: Convert data to V2Ray GeoIP dat format\n\n### Steps\n\n1. Install `golang` and `git`\n2. Clone project code: `git clone https://github.com/v2fly/geoip.git`\n3. Navigate to project root directory: `cd geoip`\n4. Install project dependencies: `go mod download`\n5. Edit config file `config.json` by referencing the configuration options in [configuration.md](https://github.com/v2fly/geoip/blob/HEAD/configuration.md)\n6. Generate files: `go run ./`\n\n### Notices\n\n- `go run ./` will use `config.json` in current directory as the default config file, or use `go run ./ -c /path/to/your/own/config/file.json` to specify your own config file.\n- The generated files are located at `output` directory by default.\n- Run `go run ./ -h` for more usage information.\n- See [configuration.md](https://github.com/v2fly/geoip/blob/HEAD/configuration.md) for all configuration options.\n\n## CLI showcase\n\nYou can run `go install -v github.com/v2fly/geoip@latest` to install the CLI tool directly.\n\n### Show help information\n\n```bash\n$ ./geoip -h\nUsage of ./geoip:\n  -c string\n    \tPath to the config file (default \"config.json\")\n  -l\tList all available input and output formats\n```\n\n### Generate GeoIP files\n\n```bash\n$ ./geoip -c config.json\n2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] geoip.dat --\u003e output/dat\n2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] geoip-only-cn-private.dat --\u003e output/dat\n2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] cn.dat --\u003e output/dat\n2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] private.dat --\u003e output/dat\n2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] test.dat --\u003e output/dat\n2021/09/02 00:26:12 ✅ [text] cn.txt --\u003e output/text\n```\n\n### List all supported formats\n\n```bash\n$ ./geoip -l\nAll available input formats:\n  - cutter (Remove data from previous steps)\n  - dbipCountryMMDB (Convert DB-IP lite country mmdb database to other formats)\n  - maxmindGeoLite2CountryCSV (Convert MaxMind GeoLite2 country CSV data to other formats)\n  - maxmindMMDB (Convert MaxMind GeoLite2 country mmdb database to other formats)\n  - private (Convert LAN and private network CIDR to other formats)\n  - test (Convert specific CIDR to other formats (for test only))\n  - text (Convert plaintext IP and CIDR to other formats)\n  - v2rayGeoIPDat (Convert V2Ray GeoIP dat to other formats)\n\nAll available output formats:\n  - text (Convert data to plaintext CIDR format)\n  - v2rayGeoIPDat (Convert data to V2Ray GeoIP dat format)\n```\n\n## License\n\nThis project is licensed under [CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/) license.\n\nThe free [IP Geolocation data by DB-IP](https://db-ip.com) is licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv2fly%2Fgeoip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv2fly%2Fgeoip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv2fly%2Fgeoip/lists"}