GeoIP MMDB from 17mon
适合在网络分流工具中使用,对中国IP的匹配分流更为友好,兼容MaxMind DB的客户端!
每周自动拉取新的17mon数据库,并发布一个新的Release版本。
在网络分流工具(例如Clash)中使用MaxMind的GeoLite2-Country
对中国IP的匹配不是很友好,实际使用中出现不少问题。
此项目,使用17mon提供的数据库,结合Maxmind的IPv6库,使得对中国IP匹配得更为友好。
从Release下载生成的Country.mmdb
。
使用方式同MaxMind官方API,可参考指导文档。
替换掉/etc/openclash/Country.mmdb
,最后重启下clash即可。
需要perl
环境,MaxMind-DB-Writer-perl
的依赖和使用可以参考官方文档。
# 下载mmdb writer
git clone https://github.com/maxmind/MaxMind-DB-Writer-perl.git writer
cd writer
# 安装依赖
curl -LO http://xrl.us/cpanm
perl cpanm -n .
perl cpanm -n Path::Class
# 构建
./Build manifest
perl Build.PL
./Build install
# 返回上级目录
cd ..
# 下载本项目
git clone https://github.com/Max-Sum/17mon-mmdb.git
cd 17mon-mmdb
# 下载GeoLite2-Country-CSV
curl -L -o GeoLite2-Country-CSV.zip "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=JvbzLLx7qBZT&suffix=zip"
unzip GeoLite2-Country-CSV.zip
rm -f GeoLite2-Country-CSV.zip
mv GeoLite2* mindmax
# 下载17mon
curl -L -o 17mon.zip "https://cdn.ipip.net/17mon/country.zip"
unzip 17mon.zip
#构建
perl china_ip_list.pl
生成的文件为Country.mmdb
。
官方对自己的数据库中的内容说明很少,都是自己一点点跟代码找出来的格式,然后据此生成的数据库。
下面列出所有字段示例供参考。
头
{
"database_type": "GeoLite2-Country",
"binary_format_major_version": 2,
"build_epoch": 1589304057,
"ip_version": 6,
"languages": [
"de",
"en",
"es",
"fr",
"ja",
"pt-BR",
"ru",
"zh-CN"
],
"description": {
"en": "GeoLite2 Country database"
},
"record_size": 24,
"node_count": 616946,
"binary_format_minor_version": 0
}
network->字段
{
"continent": {
"code": "AS",
"names": {
"de": "Asien",
"ru": "Азия",
"pt-BR": "Ásia",
"ja": "アジア",
"en": "Asia",
"fr": "Asie",
"zh-CN": "亚洲",
"es": "Asia"
},
"geoname_id": 6255147
},
"country": {
"names": {
"de": "China",
"ru": "Китай",
"pt-BR": "China",
"ja": "中国",
"en": "China",
"fr": "Chine",
"zh-CN": "中国",
"es": "China"
},
"iso_code": "CN",
"geoname_id": 1814991,
"is_in_european_union": false,
},
"registered_country": {
"names": {
"de": "China",
"ru": "Китай",
"pt-BR": "China",
"ja": "中国",
"en": "China",
"fr": "Chine",
"zh-CN": "中国",
"es": "China"
},
"iso_code": "CN",
"geoname_id": 1814991
},
"represented_country": {
"names": {
"de": "China",
"ru": "Китай",
"pt-BR": "China",
"ja": "中国",
"en": "China",
"fr": "Chine",
"zh-CN": "中国",
"es": "China"
},
"iso_code": "CN",
"geoname_id": 1814991
},
"traits": {
"is_anonymous_proxy": true,
"is_satellite_provider": true
}
}
摸索不易,引用整合或者二次发布还望留个名......