Skip to content
/ geoip Public

GeoIP for V2Ray. Generate and release GeoIP files such as geoip.dat and geoip-only-cn-private.dat for V2Ray automatically every Thursday.


Notifications You must be signed in to change notification settings


Folders and files

Last commit message
Last commit date

Latest commit



80 Commits

Repository files navigation

GeoIP for V2Ray

This project automatically weekly releases GeoIP files for routing purpose in Project V. It also provides a command line interface(CLI) for users to customize their own GeoIP files.

These 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.

Download links

GeoIP usage example in V2Ray

"routing": {
  "rules": [
      "type": "field",
      "outboundTag": "Direct",
      "ip": [
      "type": "field",
      "outboundTag": "Proxy-1",
      "ip": [
      "type": "field",
      "outboundTag": "Proxy-2",
      "ip": [
      "type": "field",
      "outboundTag": "Proxy-3",
      "ip": [

Generate GeoIP files manually

  1. Install golang and git
  2. Clone project code: git clone
  3. Navigate to project root directory: cd geoip
  4. Install project dependencies: go mod download
  5. Edit config file config.json by referencing the example configuration options in file config-example.json
  6. Generate files: go run ./


  • If input format maxmindGeoLite2CountryCSV is specified in config file, you must first download from MaxMind, then unzip it to geolite2 directory.
  • 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.
  • The generated files are located at output directory by default.
  • Run go run ./ -h for more usage information.
  • See config-example.json for more configuration options.

CLI showcase

You can run go install -v to install the CLI directly.

$ ./geoip -h
Usage of ./geoip:
  -c string
    	Path to the config file (default "config.json")
  -l	List all available input and output formats

$ ./geoip -c config.json
2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] geoip.dat --> output/dat
2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] geoip-only-cn-private.dat --> output/dat
2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] cn.dat --> output/dat
2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] private.dat --> output/dat
2021/09/02 00:26:12 ✅ [v2rayGeoIPDat] test.dat --> output/dat
2021/09/02 00:26:12 ✅ [text] cn.txt --> output/text

$ ./geoip -l
All available input formats:
  - v2rayGeoIPDat (Convert V2Ray GeoIP dat to other formats)
  - maxmindMMDB (Convert MaxMind mmdb database to other formats)
  - maxmindGeoLite2CountryCSV (Convert MaxMind GeoLite2 country CSV data to other formats)
  - text (Convert plaintext IP and CIDR to other formats)
  - private (Convert LAN and private network CIDR to other formats)
  - cutter (Remove data from previous steps)
  - test (Convert specific CIDR to other formats (for test only))
All available output formats:
  - v2rayGeoIPDat (Convert data to V2Ray GeoIP dat format)
  - text (Convert data to plaintext CIDR format)


This product includes GeoLite2 data created by MaxMind, available from MaxMind.




GeoIP for V2Ray. Generate and release GeoIP files such as geoip.dat and geoip-only-cn-private.dat for V2Ray automatically every Thursday.