本專案每週四自動產生多種格式GeoIP 文件,同時提供命令列介面(CLI)工具供使用者自訂GeoIP 文件,包含但不限於V2Ray dat
格式檔案geoip.dat
、MaxMind mmdb
格式檔案Country.mmdb
、sing -box SRS
格式檔案、mihomo MRS
格式檔案、Clash ruleset 和Surge ruleset。
This project releases various formats of GeoIP files automatically every Thursday, and provides a command line interface(CLI) tool for users to customize their own GeoIP files, including but not limited to customize their own GeoIP files, including but not limited to customize their own geoip.dat
files, including but not limited to mmdb
dmat matfile dat
Country.mmdb
, sing-box SRS
format files, mihomo MRS
format files, Clash ruleset files and Surge ruleset files.
本專案預設使用MaxMind GeoLite2 Country CSV 資料產生各國和地區的GeoIP 檔案。所有可供使用的國家和地區geoip 類別(如geoip:cn
,兩位英文字母表示國家和地區),請查看:https://www.iban.com/country-codes。
另外,本專案對MaxMind 官方GeoIP 資料做了修改與新增:
中國大陸IPv4 位址資料融合了IPIP.net 和@gaoyifan/china-operator-ip
中國大陸IPv6 位址資料融合了MaxMind GeoLite2 和@gaoyifan/china-operator-ip
新增類別(方便有特殊需求的使用者使用):
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 分支。以下是部分格式GeoIP 檔案的下載位址:
如果無法存取網域名稱
raw.githubusercontent.com
,可以使用第二個位址cdn.jsdelivr.net
。 如果無法存取網域名稱cdn.jsdelivr.net
,可以將其替換為fastly.jsdelivr.net
。*.sha256sum 為校驗檔。
適用於V2Ray、Xray-core、mihomo、hysteria、Trojan-Go。
此dat 格式檔案不能用於Nginx。
geoip.dat :
https://raw.githubusercontent.com/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://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://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://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://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://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://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/cn.dat
cn.dat.sha256sum :
https://raw.githubusercontent.com/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://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/private.dat
private.dat.sha256sum :
https://raw.githubusercontent.com/Loyalsoldier/geoip/release/private.dat.sha256sum
https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/private.dat.sha256sum
所有國家/ 地區/ 新增類別的dat 格式文件,請查看本項目release
分支下的dat 目錄。
需先下載.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" ] } ] }
geodata-mode: truegeox-url: geoip: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip.dat"
需先下載.dat
格式文件,並放置在hysteria 程式目錄內。
direct(geoip:cn) proxy(geoip:telegram) proxy(geoip:us)
需要先下載.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 檔:
適用於Clash、mihomo、Shadowrocket、Quantumult X、Surge、Leaf。
適用於Nginx,需搭配ngx_http_geoip2_module 模組使用。
GeoLite2-Country.mmdb :
https://raw.githubusercontent.com/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://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-Country.mmdb.sha256sum
MaxMind 官方版ASN類型mmdb 檔:
適用於mihomo、Shadowrocket、Surge。
GeoLite2-ASN.mmdb :
https://raw.githubusercontent.com/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://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-ASN.mmdb.sha256sum
本專案產生的國家/地區類型mmdb 檔案:
適用於Clash、mihomo、Shadowrocket、Quantumult X、Surge、Leaf。
適用於Nginx,需搭配ngx_http_geoip2_module 模組使用。
國家類別保留了
Continent
和Country
裡的所有欄位。新增類別和geoip:private類別只保留了Country
裡的iso_code
(兩個英文字母表示的國家代碼)欄位。關於Maxmind 官方country MMDB 格式檔案完整字段,請查看程式碼。
Country-without-asn.mmdb (傳統版GeoIP,僅包含國家類別,不包含上述新增類別。建議優先使用):
https://raw.githubusercontent.com/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://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://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb
Country.mmdb.sha256sum :
https://raw.githubusercontent.com/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://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://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://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://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country-asn.mmdb.sha256sum
需要先下載.mmdb
格式文件,命名為Country.mmdb
,並放置在Clash 程式目錄內。
rules: - GEOIP,PRIVATE,policy,no-resolve - GEOIP,FACEBOOK,policy - GEOIP,CN,policy,no-resolve
geodata-mode: truegeox-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 的設定中。
[Rule]
GEOIP,PRIVATE,DIRECT
GEOIP,FACEBOOK,PROXY
GEOIP,CN,DIRECT
需要將下載位址填入Quantumult X 的設定中。
[filter_local]
GEOIP,PRIVATE,DIRECT
GEOIP,FACEBOOK,PROXY
GEOIP,CN,DIRECT
需要將下載地址填入Surge 的設定中。
[Rule]
GEOIP,PRIVATE,policy,no-resolve
GEOIP,FACEBOOK,policy
GEOIP,CN,policy,no-resolve
適用於sing-box。
請查看本項目release
分支下的srs 目錄。
"route": { "rules": [ { "rule_set": "geoip-cn", "outbound": "direct"}, { "rule_set": "geoip-us", "outbound": "block"} ], "rule_set": [ { "tag": "geoip-cn", "type": "remote", "format": "binary", "url": "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/ srs/cn.srs"}, { "tag": "geoip-us", "type": "remote", "format": "binary", "url": "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/ srs/us.srs"} ] }
適用於mihomo。
請查看本項目release
分支下的mrs 目錄。
rule-providers: cn-cidr:type: httpbehavior: ipcidrformat: mrsurl: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/mrs/cn.mrs"path: ./mrs/geoip/cn .mrsinterval: 86400 google-cidr:type: httpbehavior: ipcidrformat: mrsurl: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/mrs/google.mrs"path: ./mrs/geoip/google.mrsinterval: 86.mrs"path: ./mrs/geoip/google.mrsinterval: 86400rules : - RULE-SET,cn-cidr,DIRECT - RULE-SET,google-cidr,PROXY,no-resolve
適用於Clash Premium、mihomo。
請查看本項目release
分支下的clash 目錄。
rule-providers: cn-cidr:type: httpbehavior: ipcidrformat: yamlurl: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/clash/ipcidr/cn.txt"path: ./ruleset/ipcidrdr /cn.yamlinterval: 86400 telegram-cidr:type: httpbehavior: ipcidrformat: yamlurl: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/clash/ipcidr/telegram.txt"path: ./ruleset/ipcidr/telegram. : 86400rules: - RULE-SET,cn-cidr,DIRECT - RULE-SET,telegram-cidr,PROXY,no-resolve
適用於Surge。
請查看本項目release
分支下的surge 目錄。
[Rule]
RULE-SET,https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/surge/us.txt,REJECT
RULE-SET,https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/surge/cn.txt,DIRECT
RULE-SET,https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/surge/telegram.txt,PROXY,no-resolve
請查看本項目release
分支下的text 目錄。
allow
和deny
文件請查看本項目release
分支下的nginx 目錄。
可透過以下幾種方式自行自訂GeoIP 檔案:
線上產生:Fork 本倉庫後,修改自己倉庫內的設定檔config.json
和GitHub Workflow .github/workflows/build.yml
本地生成:
安裝Golang 和Git
拉取專案代碼: git clone https://github.com/Loyalsoldier/geoip.git
進入專案根目錄: cd geoip
修改設定檔config.json
執行程式碼: go run ./ convert -c ./config.json
特別說明:
線上產生:Fork 本專案後,如果需要使用MaxMind GeoLite2 官方資料文件,需要在自己倉庫的[Settings]頁面的左側邊欄[Secrets and variables]下的[Actions]選項卡頁面中新增一個名為MAXMIND_GEOLITE2_LICENSE的secret,否則GitHub Actions 會運作失敗。這個secret 的值為MaxMind 帳號的LICENSE KEY,需要註冊MaxMind 帳號後,在個人帳號管理頁面左側邊欄的[ Manage License Keys ] 裡產生。
本地生成:如果需要使用MaxMind 官方GeoLite2 資料文件,需要提前從MaxMind 下載,或從本專案release 分支下載(檔案名稱以GeoLite2
為前綴的文件),並解壓縮到名為geolite2
的目錄。
本專案有兩個概念: input
和output
。 input
指資料來源(data source)及其輸入格式, output
指資料的去向(data destination)及其輸出格式。 CLI 的作用就是透過讀取設定檔中的選項,聚合使用者提供的所有資料來源,去重,將其轉換為目標格式,並輸出到檔案。
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 formatregate format. What the CLI does is to aggregate all input formatregate all input data, then convert them to output format and write them to GeoIP files by using the options in the config file.
關於每種格式所支援的設定選項,請查看本專案configuration.md
檔案。
支援的input
輸入格式:
text :純文字IP 和CIDR(例如: 1.1.1.1
或1.0.0.0/24
)
stdin :從standard input 取得純文字IP 和CIDR(例如: 1.1.1.1
或1.0.0.0/24
)
private :區域網路和私有網路CIDR(例如: 192.168.0.0/16
和127.0.0.0/8
)
cutter :用於裁切前置步驟中的數據
json :JSON 資料格式
v2rayGeoIPDat :V2Ray GeoIP dat 資料格式( geoip.dat
)
maxmindMMDB :MaxMind GeoLite2 country mmdb 資料格式( GeoLite2-Country.mmdb
)
maxmindGeoLite2ASNCSV :MaxMind GeoLite2 ASN CSV 資料格式( GeoLite2-ASN-CSV.zip
)
maxmindGeoLite2CountryCSV :MaxMind GeoLite2 country CSV 資料格式( GeoLite2-Country-CSV.zip
)
dbipCountryMMDB :DB-IP country mmdb 資料格式( dbip-country-lite.mmdb
)
ipinfoCountryMMDB :IPInfo country mmdb 資料格式( country.mmdb
)
mihomoMRS :mihomo MRS 資料格式( geoip-cn.mrs
)
singboxSRS :sing-box SRS 資料格式( geoip-cn.srs
)
clashRuleSetClassical :classical 類型的Clash RuleSet
clashRuleSet :ipcidr 類型的Clash RuleSet
surgeRuleSet :Surge RuleSet
支援的output
輸出格式:
text :純文字CIDR(例如: 1.0.0.0/24
)
stdout :將純文字CIDR 輸出到standard output(例如: 1.0.0.0/24
)
lookup :從指定的清單中尋找指定的IP 或CIDR
v2rayGeoIPDat :V2Ray GeoIP dat 資料格式( geoip.dat
)
maxmindMMDB :MaxMind GeoLite2 country mmdb 資料格式( GeoLite2-Country.mmdb
)
dbipCountryMMDB :DB-IP country mmdb 資料格式( dbip-country-lite.mmdb
)
ipinfoCountryMMDB :IPInfo country mmdb 資料格式( country.mmdb
)
mihomoMRS :mihomo MRS 資料格式( geoip-cn.mrs
)
singboxSRS :sing-box SRS 資料格式( geoip-cn.srs
)
clashRuleSetClassical :classical 類型的Clash RuleSet
clashRuleSet :ipcidr 類型的Clash RuleSet
surgeRuleSet :Surge RuleSet
由於MaxMind、DB-IP、IPInfo 的mmdb 檔案格式的限制,當不同清單的IP 或CIDR 資料有交集或重複項目時,後寫入的清單的IP 或CIDR 資料會覆蓋(overwrite)之前已寫入的列表的數據。譬如,IP 1.1.1.1
同屬於列表AU
和列表Cloudflare
。如果Cloudflare
在AU
之後寫入,則IP 1.1.1.1
歸屬於清單Cloudflare
。
為了確保某些指定的列表、被修改的列表一定囊括屬於它的所有IP 或CIDR 數據,可在output
相應輸出格式的配置中增加選項overwriteList
,該選項中指定的列表會在最後逐一寫入,列表中最後一項優先級最高。若已設定選項wantedList
,則無需設定overwriteList
。 wantedList
中指定的清單會在最後逐一寫入,清單中最後一項優先順序最高。
可透過go install -v github.com/Loyalsoldier/geoip@latest
直接安裝CLI 工具。
CLI 提供的功能如下:
列出支援的input
和output
格式( list
)
GeoIP 資料格式轉換( convert
)
尋找IP 或CIDR 所在類別( lookup
)
去重合併IP 與CIDR( merge
)
$ ./geoip geoip is a convenient tool to merge, convert and lookup IP & CIDR from various formats of geoip data. Usage: geoip [command] Available Commands: convert Convert geoip data from one format to another by using config file help Help about any command list List all available input and output formats lookup Lookup specified IP or CIDR in specified lists merge Merge plaintext IP & CIDR from standard input, then print to standard output Flags: -h, --help help for geoip Use "geoip [command] --help" for more information about a command.
input
和output
格式( list
)$ ./geoip list All available input formats: - clashRuleSet (Convert ipcidr type of Clash RuleSet to other formats) - clashRuleSetClassical (Convert classical type of Clash RuleSet to other formats (just processing IP & CIDR lines)) - cutter (Remove data from previous steps) - dbipCountryMMDB (Convert DB-IP country mmdb database to other formats) - ipinfoCountryMMDB (Convert IPInfo country mmdb database to other formats) - json (Convert JSON data to other formats) - maxmindGeoLite2ASNCSV (Convert MaxMind GeoLite2 ASN CSV data to other formats) - maxmindGeoLite2CountryCSV (Convert MaxMind GeoLite2 country CSV data to other formats) - maxmindMMDB (Convert MaxMind mmdb database to other formats) - mihomoMRS (Convert mihomo MRS data to other formats) - private (Convert LAN and private network CIDR to other formats) - singboxSRS (Convert sing-box SRS data to other formats) - stdin (Accept plaintext IP & CIDR from standard input, separated by newline) - surgeRuleSet (Convert Surge RuleSet to other formats (just processing IP & CIDR lines)) - test (Convert specific CIDR to other formats (for test only)) - text (Convert plaintext IP & CIDR to other formats) - v2rayGeoIPDat (Convert V2Ray GeoIP dat to other formats) All available output formats: - clashRuleSet (Convert data to ipcidr type of Clash RuleSet) - clashRuleSetClassical (Convert data to classical type of Clash RuleSet) - dbipCountryMMDB (Convert data to DB-IP country mmdb database format) - ipinfoCountryMMDB (Convert data to IPInfo country mmdb database format) - lookup (Lookup specified IP or CIDR from various formats of data) - maxmindMMDB (Convert data to MaxMind mmdb database format) - mihomoMRS (Convert data to mihomo MRS format) - singboxSRS (Convert data to sing-box SRS format) - stdout (Convert data to plaintext CIDR format and output to standard output) - surgeRuleSet (Convert data to Surge RuleSet) - text (Convert data to plaintext CIDR format) - v2rayGeoIPDat (Convert data to V2Ray GeoIP dat format)
merge
)$ curl -s https://core.telegram.org/resources/cidr.txt | ./geoip merge -t ipv4 91.105.192.0/23 91.108.4.0/22 91.108.8.0/21 91.108.16.0/21 91.108.56.0/22 149.154.160.0/20 185.76.151.0/24
convert
)$ ./geoip convert -c config.json 2021/08/29 12:11:35 ✅ [v2rayGeoIPDat] geoip.dat --> output/dat 2021/08/29 12:11:35 ✅ [v2rayGeoIPDat] geoip-only-cn-private.dat --> output/dat 2021/08/29 12:11:35 ✅ [v2rayGeoIPDat] geoip-asn.dat --> output/dat 2021/08/29 12:11:35 ✅ [v2rayGeoIPDat] cn.dat --> output/dat 2021/08/29 12:11:35 ✅ [v2rayGeoIPDat] private.dat --> output/dat 2021/08/29 12:11:39 ✅ [maxmindMMDB] Country.mmdb --> output/maxmind 2021/08/29 12:11:39 ✅ [maxmindMMDB] Country-only-cn-private.mmdb --> output/maxmind 2021/08/29 12:11:39 ✅ [text] netflix.txt --> output/text 2021/08/29 12:11:39 ✅ [文本] telegram.txt --> output/text 2021/08/29 12:11:39 ✅ [text] cn.txt --> output/text 2021/08/29 12:11:39 ✅ [text] cloudflare.txt --> output/text 2021/08/29 12:11:39 ✅ [text] cloudfront.txt --> output/text 2021/08/29 12:11:39 ✅ [text] facebook.txt --> output/text 2021/08/29 12:11:39 ✅ [text] fastly.txt --> output/text 2021/08/29 12:11:45 ✅ [singboxSRS] netflix.txt --> output/srs 2021/08/29 12:11:45 ✅ [singboxSRS] telegram.txt --> output/srs 2021/08/29 12:11:45 ✅ [singboxSRS] cn.txt --> output/srs 2021/08/29 12:11:45 ✅ [singboxSRS] cloudflare.txt --> output/srs 2021/08/29 12:11:45 ✅ [singboxSRS] cloudfront.txt --> output/srs 2021/08/29 12:11:45 ✅ [singboxSRS] facebook.txt --> output/srs 2021/08/29 12:11:45 ✅ [singboxSRS] fastly.txt --> output/srs 2021/08/29 12:11:50 ✅ [mihomoMRS] netflix.txt --> output/mrs 2021/08/29 12:11:50 ✅ [mihomoMRS] telegram.txt --> output/mrs 2021/08/29 12:11:50 ✅ [mihomoMRS] cn.txt --> output/mrs 2021/08/29 12:11:50 ✅ [mihomoMRS] cloudflare.txt --> output/mrs 2021/08/29 12:11:50 ✅ [mihomoMRS] cloudfront.txt --> output/mrs 2021/08/29 12:11:50 ✅ [mihomoMRS] facebook.txt --> output/mrs 2021/08/29 12:11:50 ✅ [mihomoMRS] fastly.txt --> output/mrs
lookup
)可能的回傳結果:
查詢的字串不是有效的IP 或CIDR,回傳false
查詢的IP 或CIDR 不存在於任何一個類別中,回傳false
查詢的IP 或CIDR 存在於某種格式檔案的單一類別中:
若該格式檔案只包含一個類別,則回傳true
若該格式檔案包含多個類別,則傳回符合的類別名稱
查詢的IP 或CIDR 存在於多個類別中,傳回以英文逗號分隔的類別名稱,如au,cloudflare
# ================= One-time Mode ================= ## 從text 格式的本機檔案(只包含在一個類別)中尋找某個IP 位址# lookup IP from local file (with only one list) in text format$ ./geoip lookup -f text -u ./cn.txt 1.0.1.1true# 從text 格式的本機檔案(只包含一個類別)中尋找某個IP 位址# lookup IP from local file (with only one list) in text format$ ./geoip lookup -f text -u ./cn.txt 2.2.2.2false# 從text 格式的本機檔案(只包含一個類別)中尋找某個CIDR# lookup CIDR from local file (with only one list) in text format$ ./geoip lookup -f text -u ./cn.txt 1.0.1.1/24true#從text 格式的本機檔案(只包含一個類別)尋找某個CIDR# lookup CIDR from local file (with only one list) in text format$ ./geoip lookup -f text -u ./cn.txt 1.0.1.1 /23false# 從text 格式的遠端URL(只包含一個類別)中尋找某個IP 位址# lookup IP from remote URL (with only one list) in text format$ ./geoip lookup -f text -u https:// example.com/cn.txt 1.0.1.1true# 從v2rayGeoIPDat 格式的本機檔案(只包含一個類別)尋找某個IP 位址# lookup IP from local file (with only one list) in v2rayGeoIPDat format$ ./geoip lookup -f v2rayGeoIPDat -u ./cn.dat 1.0.1.1true# 從v2rayGeoIPDat 格式的本機檔案(包含多個類別)中尋找某個IP 位址# lookup IP from local file (with multiple lists) in v2rayGeoIPDat format$ ./ geoip lookup -f v2rayGeoIPDat -u ./geoip.dat 1.0.1.1 cn# 從v2rayGeoIPDat 格式的本地檔案(包含多個類別)中尋找某個IP 位址# lookup IP from local file (with multiple lists) in v2rayGeoIPDat format$ ./geoip lookup -f v2rayGeoIPDat -u ./geoip.dat 1. .0.1 au,cloudflare# 從v2rayGeoIPDat 格式的遠端URL(包含多個類別)中尋找某個CIDR# lookup CIDR from remote URL (with multiple lists) in v2rayGeoIPDat format$ ./geoip lookup -f v2rayGeoIPDat - https://example .com/geoip.dat 1.0.0.1/24 au,cloudflare# ================= REPL Mode ================= ## 從text 格式的本機檔案(只包含一個類別)中尋找某個IP 位址或CIDR# lookup IP or CIDR from local file (with only one list) in text format$ ./geoip lookup -f text -u ./cn.txt Enter IP or CIDR (type "exit" 至 quit):>> 1.0.1.1true>> 1.0.1.1/24true>> 1.0.1.1/23false>> 2.2.2.2false>> 2.2.2.2/24false>> 30. 300.300false>> 300.300.300.300/24false>> exit# 從text 格式的遠端URL(只包含一個類別)中找出某個IP 位址或CIDR# lookup IP or CIDR from remote URL (with only one list) in text for $ ./geoip lookup -f text -u https://example.com/cn.txt Enter IP or CIDR (type "exit" 至 quit):>> 1.0.1.1true>> 1.0.1.1/24true>> 1.0.1.1/23false>> 2.2.2.2false>> 2.2.2.2/24false>> 30. 300.300false>> 300.300.300.300/24false>> exit# 從v2rayGeoIPDat 格式的本機檔案(只包含一個類別)中尋找某個IP 位址或CIDR# lookup IP or CIDR from local file (with on 位址$ ./geoip lookup -f v2rayGeoIPDat -u ./cn.dat Enter IP or CIDR (type "exit" 至 quit):>> 1.0.1.1true>> 1.0.1.1/24true>> 1.0.1.1/23false>> 2.2.2.2false>> 2.2.2.2/24false>> 30. 300.300false>> 300.300.300.300/24false>> exit# 從v2rayGeoIPDat 格式的遠端URL(包含多個類別)中尋找某個IP 位址或CIDR# lookup IP or CIDR from remote(包含多個類別)中尋找某個IP 位址或CIDR# lookup IP or CIDR from remote 是 (with multial list」 ./geoip lookup -f v2rayGeoIPDat -u https://example.com/geoip.dat Enter IP or CIDR (type "exit" to quit):>> 1.0.1.1 cn>> 1.0.1.1/24 cn>> 1.0.1.1/23false>> 1.0.0.1 au,cloudflare>> 1.0.0.1/24 au,cloudflare>> 300.300.300.300false>> 300.300.300.300/24false>> exit
@Loyalsoldier/v2ray-rules-dat
@Loyalsoldier/clash-rules
@Loyalsoldier/surge-rules
CC-BY-SA-4.0 and GPL-3.0
This product includes GeoLite2 data created by MaxMind, available from MaxMind.