Loyalsoldier/geoip

GitHub: Loyalsoldier/geoip

一站式增强版 GeoIP 规则库,自动生成多格式文件,支持主流代理工具的地理位置和服务商分流。

Stars: 5759 | Forks: 851

# GeoIP 简介 [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Loyalsoldier/geoip) ![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/Loyalsoldier/geoip/total?logo=github) ![GitHub Downloads (all assets, latest release)](https://img.shields.io/github/downloads/Loyalsoldier/geoip/latest/total?logo=github) [![jsdelivr stats](https://data.jsdelivr.com/v1/package/gh/Loyalsoldier/geoip/badge?style=rounded)](https://www.jsdelivr.com/package/gh/Loyalsoldier/geoip) 本项目每周四自动生成多种格式 GeoIP 文件,同时提供命令行界面(CLI)工具供用户自行定制 GeoIP 文件,包括但不限于 V2Ray `dat` 格式文件 `geoip.dat`、MaxMind `mmdb` 格式文件 `Country.mmdb`、sing-box `SRS` 格式文件、mihomo `MRS` 格式文件、Clash ruleset 和 Surge ruleset。 ## 与 MaxMind 官方 GeoIP 数据的区别 本项目默认使用 [MaxMind GeoLite2 Country CSV 数据](https://github.com/Loyalsoldier/geoip/blob/release/GeoLite2-Country-CSV.zip)生成各个国家和地区的 GeoIP 文件。所有可供使用的国家和地区 geoip 类别(如 `geoip:cn`,两位英文字母表示国家和地区),请查看:[https://www.iban.com/country-codes](https://www.iban.com/country-codes)。 另外,本项目对 MaxMind 官方 GeoIP 数据做了修改和新增: - 中国大陆 IPv4 地址数据融合了 [IPIP.net](https://github.com/17mon/china_ip_list/blob/master/china_ip_list.txt) 和 [@gaoyifan/china-operator-ip](https://github.com/gaoyifan/china-operator-ip/blob/ip-lists/china.txt) - 中国大陆 IPv6 地址数据使用 [@gaoyifan/china-operator-ip](https://github.com/gaoyifan/china-operator-ip/blob/ip-lists/china6.txt) - 新增类别(方便有特殊需求的用户使用): - `geoip:cloudflare`(`GEOIP,CLOUDFLARE`) - `geoip:cloudfront`(`GEOIP,CLOUDFRONT`) - `geoip:facebook`(`GEOIP,FACEBOOK`) - `geoip:fastly`(`GEOIP,FASTLY`) - `geoip:google`(`GEOIP,GOOGLE`) - `geoip:netflix`(`GEOIP,NETFLIX`) - `geoip:telegram`(`GEOIP,TELEGRAM`) - `geoip:twitter`(`GEOIP,TWITTER`) - `geoip:tor`(`GEOIP,TOR`) ## 下载地址与使用方法 本项目发布的所有 GeoIP 文件,请查看 [release 分支](https://github.com/Loyalsoldier/geoip/tree/release)。以下是部分格式 GeoIP 文件的下载地址: ### V2Ray dat 格式文件 - **geoip.dat**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip.dat](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip.dat) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip.dat](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip.dat) - **geoip.dat.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip.dat.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip.dat.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip.dat.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip.dat.sha256sum) - **geoip-only-cn-private.dat**(精简版 GeoIP,只包含 `geoip:cn` 和 `geoip:private`): - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-only-cn-private.dat](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-only-cn-private.dat) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip-only-cn-private.dat](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip-only-cn-private.dat) - **geoip-only-cn-private.dat.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-only-cn-private.dat.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-only-cn-private.dat.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip-only-cn-private.dat.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip-only-cn-private.dat.sha256sum) - **geoip-asn.dat**(精简版 GeoIP,只包含上述新增类别): - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-asn.dat](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-asn.dat) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip-asn.dat](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip-asn.dat) - **geoip-asn.dat.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-asn.dat.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-asn.dat.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip-asn.dat.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip-asn.dat.sha256sum) - **cn.dat**(精简版 GeoIP,只包含 `geoip:cn`): - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/cn.dat](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/cn.dat) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/cn.dat](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/cn.dat) - **cn.dat.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/cn.dat.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/cn.dat.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/cn.dat.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/cn.dat.sha256sum) - **private.dat**(精简版 GeoIP,只包含 `geoip:private`): - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/private.dat](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/private.dat) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/private.dat](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/private.dat) - **private.dat.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/private.dat.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/private.dat.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/private.dat.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/private.dat.sha256sum) - **所有国家 / 地区 / 新增类别**的 dat 格式文件,请查看本项目 `release` 分支下的 [dat 目录](https://github.com/Loyalsoldier/geoip/tree/release/dat)。 #### dat 格式文件使用方法
点击查看在 V2RayXray-core 中的使用方法

需要先下载 .dat 格式文件,并放置在程序目录内。

``` "routing": { "rules": [ { "type": "field", "outboundTag": "Direct", "ip": [ "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", "ip": [ "geoip:us", "geoip:jp", "geoip:facebook", "geoip:telegram", "ext:geoip-asn.dat:facebook", "ext:geoip-asn.dat:telegram" ] } ] } ```
点击查看在 mihomo 中的使用方法 ``` geodata-mode: true geox-url: geoip: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip.dat" ```
点击查看在 hysteria 中的使用方法

需要先下载 .dat 格式文件,并放置在 hysteria 程序目录内。

``` direct(geoip:cn) proxy(geoip:telegram) proxy(geoip:us) ```
点击查看在 Trojan-Go 中的使用方法

需要先下载 .dat 格式文件,并放置在 Trojan-Go 程序目录内。

``` "router": { "enabled": true, "bypass": ["geoip:cn"], "proxy": ["geoip:telegram", "geoip:us"], "block": ["geoip:jp"], "default_policy": "proxy", "geoip": "./geoip.dat" } ```
### MaxMind mmdb 格式文件 MaxMind 官方版**国家/地区**类型 mmdb 文件: - **GeoLite2-Country.mmdb**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/GeoLite2-Country.mmdb](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/GeoLite2-Country.mmdb) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-Country.mmdb](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-Country.mmdb) - **GeoLite2-Country.mmdb.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/GeoLite2-Country.mmdb.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/GeoLite2-Country.mmdb.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-Country.mmdb.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-Country.mmdb.sha256sum) MaxMind 官方版 **ASN** 类型 mmdb 文件: - **GeoLite2-ASN.mmdb**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/GeoLite2-ASN.mmdb](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/GeoLite2-ASN.mmdb) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-ASN.mmdb](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-ASN.mmdb) - **GeoLite2-ASN.mmdb.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/GeoLite2-ASN.mmdb.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/GeoLite2-ASN.mmdb.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-ASN.mmdb.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-ASN.mmdb.sha256sum) 本项目生成的**国家/地区**类型 mmdb 文件: - **Country-without-asn.mmdb**(传统版 GeoIP,只包含国家/地区类别,不包含上述新增类别。建议优先使用): - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-without-asn.mmdb](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-without-asn.mmdb) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-without-asn.mmdb](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-without-asn.mmdb) - **Country-without-asn.mmdb.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-without-asn.mmdb.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-without-asn.mmdb.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-without-asn.mmdb.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-without-asn.mmdb.sha256sum) - **Country.mmdb**(增强版 GeoIP,包含国家/地区类别,以及上述新增类别。但由于 MaxMind mmdb 格式限制,部分国家/地区类别的 IP 地址数据不如上述 **Country-without-asn.mmdb** 准确): - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb) - **Country.mmdb.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb.sha256sum) - **Country-only-cn-private.mmdb**(精简版 GeoIP,只包含 `GEOIP,CN` 和 `GEOIP,PRIVATE`): - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-only-cn-private.mmdb](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-only-cn-private.mmdb) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-only-cn-private.mmdb](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-only-cn-private.mmdb) - **Country-only-cn-private.mmdb.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-only-cn-private.mmdb.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-only-cn-private.mmdb.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-only-cn-private.mmdb.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-only-cn-private.mmdb.sha256sum) - **Country-asn.mmdb**(精简版 GeoIP,只包含上述新增类别): - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-asn.mmdb](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-asn.mmdb) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-asn.mmdb](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-asn.mmdb) - **Country-asn.mmdb.sha256sum**: - [https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-asn.mmdb.sha256sum](https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country-asn.mmdb.sha256sum) - [https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-asn.mmdb.sha256sum](https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-asn.mmdb.sha256sum) #### mmdb 格式文件使用方法
点击查看在 Clash 中的使用方法

需要先下载 .mmdb 格式文件,命名为 Country.mmdb,并放置在 Clash 程序目录内。

``` rules: - GEOIP,PRIVATE,policy,no-resolve - GEOIP,FACEBOOK,policy - GEOIP,CN,policy,no-resolve ```
点击查看在 mihomo 中的使用方法 ``` geodata-mode: false geox-url: mmdb: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb" asn: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-ASN.mmdb" ```
点击查看在 Shadowrocket 中的使用方法
标签:Censorship Circumvention, Clash, CLI, dat格式, EVTX分析, GeoIP, GeoIP 数据库, GFW, GitHub, IPv4, IPv6, IP地址库, IP 地址批量处理, IP归属地, Linux安全, MaxMind, mmdb, MRS, PowerShell, Privacy, sing-box, SRS, Surge, V2Ray, WiFi技术, Xray, 代理工具, 密码管理, 开源, 日志审计, 科学上网, 网络分流, 网络安全, 网络流量路由, 自定义规则, 规则文件, 规则集, 防火墙, 隐私保护