This project is a fork of v2fly/geoip, which releases GeoIP files automatically every Thursday for routing in supported EEPs.
- Databases are sourced from DB-IP.com instead of MaxMind.
- Carrier-grade NAT (CNAT) ranges are excluded from
private, because they should never be considered as such. - A lite version of the databases are also included covering repressive regimes (Iran, Russia, China, Turkimenistan, Belarus, Egypt).
- As such,
geoip-only-cn-private.datis no longer included.
- As such,
geoip.dat: IP to country database, with private ranges available.asnip.dat: IP to ASN database with private ranges.geoip-lean.dat: IP to country database only including countries of interest, with private ranges available.asnip-lean.dat: IP to ASN database only including countries of interest, with private ranges available.
The sections below are from the forked project.
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:
- 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
- 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
Supported output formats:
- text: Convert data to plaintext CIDR format
- v2rayGeoIPDat: Convert data to V2Ray GeoIP dat format
- Install
golangandgit - Clone project code:
git clone https://github.com/v2fly/geoip.git - Navigate to project root directory:
cd geoip - Install project dependencies:
go mod download - Edit config file
config.jsonby referencing the configuration options in configuration.md - Generate files:
go run ./
- If input format
maxmindGeoLite2CountryCSVis specified in config file, you must first downloadGeoLite2-Country-CSV.zipfrom MaxMind, then unzip it togeolite2directory. go run ./will useconfig.jsonin current directory as the default config file, or usego run ./ -c /path/to/your/own/config/file.jsonto specify your own config file.- The generated files are located at
outputdirectory by default. - Run
go run ./ -hfor more usage information. - See configuration.md for all configuration options.
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.