This project releases GeoIP files automatically every Thursday for routing purpose in Project V. It also provides a command line interface(CLI) tool for users to customize their own GeoIP files.
For all GeoIP files released by this project, see the release branch. Below are download URLs for some GeoIP files:
"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"
]
}
]
}
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.
Supported input
formats:
Supported output
formats:
golang
and git
git clone https://github.com/v2fly/geoip.git
cd geoip
go mod download
config.json
by referencing the configuration options in configuration.mdgo run ./
maxmindGeoLite2CountryCSV
is specified in config file, you must first download GeoLite2-Country-CSV.zip
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.output
directory by default.go run ./ -h
for more usage information.You can run go install -v github.com/v2fly/geoip@latest
to install the CLI tool 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:
- cutter (Remove data from previous steps)
- maxmindGeoLite2CountryCSV (Convert MaxMind GeoLite2 country CSV data to other formats)
- maxmindMMDB (Convert MaxMind mmdb database to other formats)
- private (Convert LAN and private network CIDR to other formats)
- test (Convert specific CIDR to other formats (for test 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)
This product includes GeoLite2 data created by MaxMind, available from MaxMind.