Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

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

License

NotificationsYou must be signed in to change notification settings

v2fly/geoip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Download links

For all GeoIP files released by this project, see therelease branch. Below are download URLs for some GeoIP files:

GeoIP usage example in V2Ray

"routing": {"rules": [    {"type":"field","outboundTag":"Direct","ip": ["223.5.5.5/32","119.29.29.29/32","180.76.76.76/32","114.114.114.114/32","geoip:cn","geoip:private","ext:cn.dat:cn","ext:private.dat:private","ext:geoip-only-cn-private.dat:cn","ext:geoip-only-cn-private.dat:private"      ]    },    {"type":"field","outboundTag":"Proxy-1","ip": ["1.1.1.1/32","1.0.0.1/32","8.8.8.8/32","8.8.4.4/32"      ]    },    {"type":"field","outboundTag":"Proxy-2","ip": ["geoip:us","geoip:ca"      ]    },    {"type":"field","outboundTag":"Proxy-3","ip": ["geoip:hk","geoip:mo","geoip:tw","geoip:jp","geoip:sg"      ]    }  ]}

Customize GeoIP files

Concept explanation

These two concepts are notable:input andoutput. Theinput is the data source and its input format, whereas theoutput 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.

Supported formats

Supportedinput formats:

  • cutter: Remove data from previous steps
  • maxmindGeoLite2CountryCSV: Convert MaxMind GeoLite2 country CSV data to other formats
  • maxmindMMDB: Convert MaxMind country mmdb database to other formats
  • dbipCountryMMDB: Convert DB-IP lite country mmdb database to other formats
  • private: Convert LAN and private network CIDR to other formats
  • text: Convert plaintext IP and CIDR to other formats
  • v2rayGeoIPDat: Convert V2Ray GeoIP dat to other formats

Supportedoutput formats:

  • text: Convert data to plaintext CIDR format
  • v2rayGeoIPDat: Convert data to V2Ray GeoIP dat format

Steps

  1. Installgolang andgit
  2. Clone project code:git clone https://github.com/v2fly/geoip.git
  3. Navigate to project root directory:cd geoip
  4. Install project dependencies:go mod download
  5. Edit config fileconfig.json by referencing the configuration options inconfiguration.md
  6. Generate files:go run ./

Notices

  • go run ./ will useconfig.json in current directory as the default config file, or usego run ./ -c /path/to/your/own/config/file.json to specify your own config file.
  • The generated files are located atoutput directory by default.
  • Rungo run ./ -h for more usage information.
  • Seeconfiguration.md for all configuration options.

CLI showcase

You can rungo install -v github.com/v2fly/geoip@latest to install the CLI tool directly.

Show help information

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

Generate GeoIP files

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

List all supported formats

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

License

This project is licensed underCC-BY-SA-4.0 license.

The freeIP Geolocation data by DB-IP is licensed underCC-BY-4.0 license.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp