|
1 | 1 | # 简介 |
2 | 2 |
|
3 | | -[**V2Ray**](https://github.com/v2fly/v2ray-core) 路由规则文件加强版,可代替 V2Ray 官方 `geoip.dat` 和 `geosite.dat`,兼容 [Shadowsocks-windows](https://github.com/shadowsocks/shadowsocks-windows)、[Xray-core](https://github.com/XTLS/Xray-core)、[Trojan-Go](https://github.com/p4gefau1t/trojan-go)、[leaf](https://github.com/eycorsican/leaf) 和 [hysteria](https://github.com/apernet/hysteria)。使用 GitHub Actions 北京时间每天早上 6 点自动构建,保证规则最新。 |
| 3 | +[**V2Ray**](https://github.com/v2fly/v2ray-core) 路由规则文件加强版,可代替 V2Ray 官方 `geoip.dat` 和 `geosite.dat`,适用于 [V2Ray](https://github.com/v2fly/v2ray-core)、[Xray-core](https://github.com/XTLS/Xray-core)、[mihomo](https://github.com/MetaCubeX/mihomo/tree/Meta)、[hysteria](https://github.com/apernet/hysteria)、[Trojan-Go](https://github.com/p4gefau1t/trojan-go)、[leaf](https://github.com/eycorsican/leaf)。使用 GitHub Actions 北京时间每天早上 6 点自动构建,保证规则最新。 |
4 | 4 |
|
5 | 5 | ## 规则文件生成方式 |
6 | 6 |
|
7 | 7 | ### geoip.dat |
8 | 8 |
|
9 | 9 | - 通过仓库 [@Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip) 生成 |
10 | | -- 其中全球 IP 地址(IPv4 和 IPv6)来源于 [MaxMind GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/),`CN`(中国大陆)类别下的 IPv4 地址融合了 [ipip.net](https://github.com/17mon/china_ip_list) 和 [@gaoyifan/china-operator-ip](https://github.com/gaoyifan/china-operator-ip),`CN`(中国大陆)类别下的 IPv6 地址融合了 [MaxMind GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/) 和 [@gaoyifan/china-operator-ip](https://github.com/gaoyifan/china-operator-ip) |
| 10 | +- 默认使用 [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) |
| 11 | +- 中国大陆 (`geoip:cn`) 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) |
| 12 | +- 中国大陆 (`geoip:cn`) IPv6 地址数据融合了 MaxMind GeoLite2 和 [@gaoyifan/china-operator-ip](https://github.com/gaoyifan/china-operator-ip/blob/ip-lists/china6.txt) |
11 | 13 | - 新增类别(方便有特殊需求的用户使用): |
12 | 14 | - `geoip:cloudflare` |
13 | 15 | - `geoip:cloudfront` |
|
18 | 20 | - `geoip:telegram` |
19 | 21 | - `geoip:twitter` |
20 | 22 |
|
21 | | -> 希望定制 `geoip.dat` 文件?查看仓库 [@Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip)。 |
| 23 | +> 希望定制 `geoip.dat` 文件?需要适用于其他代理软件的 GeoIP 格式文件?查看项目 [@Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip)。 |
22 | 24 |
|
23 | 25 | ### geosite.dat |
24 | 26 |
|
|
44 | 46 | - **可添加自定义直连、代理和广告域名**:由于上游域名列表更新缓慢或缺失某些域名,所以引入**需要添加的域名**列表。[`hidden 分支`](https://github.com/Loyalsoldier/v2ray-rules-dat/tree/hidden)里的三个文件 `direct.txt`、`proxy.txt` 和 `reject.txt`,分别存放自定义的需要添加的直连、代理、广告域名,最终分别加入到 `geosite:cn`、`geosite:geolocation-!cn` 和 `geosite:category-ads-all` 类别中 |
45 | 47 | - **可移除自定义直连、代理和广告域名**:由于上游域名列表存在需要被移除的域名,所以引入**需要移除的域名**列表。[`hidden 分支`](https://github.com/Loyalsoldier/v2ray-rules-dat/tree/hidden)里的三个文件 `direct-need-to-remove.txt`、`proxy-need-to-remove.txt` 和 `reject-need-to-remove.txt`,分别存放自定义的需要从 `direct-list`(直连域名列表)、`proxy-list`(代理域名列表)和 `reject-list`(广告域名列表) 移除的域名 |
46 | 48 |
|
47 | | -## 规则文件下载及使用方式 |
| 49 | +## 规则文件下载地址 |
48 | 50 |
|
49 | | -**下载地址**: |
50 | | - |
51 | | -> 如果无法访问域名 `raw.githubusercontent.com`,可以使用第二个地址(`cdn.jsdelivr.net`),但是内容更新会有 12 小时的延迟。 |
| 51 | +> 如果无法访问域名 `raw.githubusercontent.com`,可以使用第二个地址 `cdn.jsdelivr.net`。 |
| 52 | +> 如果无法访问域名 `cdn.jsdelivr.net`,可以将其替换为 `fastly.jsdelivr.net`。 |
| 53 | +> |
| 54 | +> *.sha256sum 为校验文件。 |
52 | 55 |
|
53 | 56 | - **geoip.dat**: |
54 | 57 | - [https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat](https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat) |
|
87 | 90 | - [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-extra.txt](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-extra.txt) |
88 | 91 | - [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/win-extra.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/win-extra.txt) |
89 | 92 |
|
90 | | -**使用方式**: |
91 | | - |
92 | | -1. 安装适用于自己操作系统的客户端 |
93 | | -2. 下载本项目的 `geoip.dat` 和 `geosite.dat` |
94 | | -3. 把下载下来的 `geoip.dat` 和 `geosite.dat` 放入到客户端的规则文件目录,替换掉原来的 `geoip.dat` 和 `geosite.dat` |
95 | | -4. 如果使用的是 V2Ray v4 版本客户端,配置可参考下面 👇👇👇 |
96 | | - |
97 | | -## 参考配置(仅适用于 V2Ray v4 版本) |
| 93 | +## 规则文件使用方式 |
98 | 94 |
|
99 | 95 | ### geoip.dat |
100 | 96 |
|
101 | | -跟 V2Ray 官方 `geoip.dat` 配置方式相同。 |
102 | | - |
103 | | -**Routing 配置方式**: |
| 97 | +<details> |
| 98 | + <summary>点击查看在 <b>V2Ray</b> 和 <b>Xray-core</b> 中的使用方法</summary> |
| 99 | + <br/> |
| 100 | + <p>需要先下载 <code>geoip.dat</code> 格式文件,并放置在程序目录内。</p> |
104 | 101 |
|
105 | 102 | ```json |
106 | 103 | "routing": { |
|
109 | 106 | "type": "field", |
110 | 107 | "outboundTag": "Direct", |
111 | 108 | "ip": [ |
112 | | - "223.5.5.5/32", |
113 | | - "119.29.29.29/32", |
114 | | - "180.76.76.76/32", |
115 | | - "114.114.114.114/32", |
116 | 109 | "geoip:cn", |
117 | | - "geoip:private" |
| 110 | + "geoip:private", |
| 111 | + "ext:cn.dat:cn", |
| 112 | + "ext:private.dat:private", |
| 113 | + "ext:geoip-only-cn-private.dat:cn", |
| 114 | + "ext:geoip-only-cn-private.dat:private" |
118 | 115 | ] |
119 | 116 | }, |
120 | 117 | { |
121 | 118 | "type": "field", |
122 | 119 | "outboundTag": "Proxy", |
123 | 120 | "ip": [ |
124 | | - "1.1.1.1/32", |
125 | | - "1.0.0.1/32", |
126 | | - "8.8.8.8/32", |
127 | | - "8.8.4.4/32", |
128 | 121 | "geoip:us", |
129 | | - "geoip:ca", |
130 | | - "geoip:telegram" |
| 122 | + "geoip:jp", |
| 123 | + "geoip:facebook", |
| 124 | + "geoip:telegram", |
| 125 | + "ext:geoip-asn.dat:facebook", |
| 126 | + "ext:geoip-asn.dat:telegram" |
131 | 127 | ] |
132 | 128 | } |
133 | 129 | ] |
134 | 130 | } |
135 | 131 | ``` |
| 132 | +</details> |
| 133 | + |
| 134 | +<details> |
| 135 | + <summary>点击查看在 <b>mihomo</b> 中的使用方法</summary> |
| 136 | + |
| 137 | +```yaml |
| 138 | +geodata-mode: true |
| 139 | +geox-url: |
| 140 | + geoip: "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" |
| 141 | +``` |
| 142 | +</details> |
| 143 | +
|
| 144 | +<details> |
| 145 | + <summary>点击查看在 <b>hysteria</b> 中的使用方法</summary> |
| 146 | + <br/> |
| 147 | + <p>需要先下载 <code>geoip.dat</code> 格式文件,并放置在 hysteria 程序目录内。</p> |
| 148 | +
|
| 149 | +``` |
| 150 | +direct(geoip:cn) |
| 151 | +proxy(geoip:telegram) |
| 152 | +proxy(geoip:us) |
| 153 | +``` |
| 154 | +</details> |
| 155 | + |
| 156 | +<details> |
| 157 | + <summary>点击查看在 <b>Trojan-Go</b> 中的使用方法</summary> |
| 158 | + <br/> |
| 159 | + <p>需要先下载 <code>geoip.dat</code> 格式文件,并放置在 Trojan-Go 程序目录内。</p> |
| 160 | + |
| 161 | +```json |
| 162 | +"router": { |
| 163 | + "enabled": true, |
| 164 | + "bypass": ["geoip:cn"], |
| 165 | + "proxy": ["geoip:telegram", "geoip:us"], |
| 166 | + "block": ["geoip:jp"], |
| 167 | + "default_policy": "proxy", |
| 168 | + "geoip": "./geoip.dat" |
| 169 | +} |
| 170 | +``` |
| 171 | +</details> |
136 | 172 |
|
137 | 173 | ### geosite.dat |
138 | 174 |
|
@@ -433,11 +469,6 @@ steamstatic.com.8686c.com @cn |
433 | 469 | } |
434 | 470 | ``` |
435 | 471 |
|
436 | | -## 使用本项目的项目 |
437 | | - |
438 | | -- [@Loyalsoldier/clash-rules](https://github.com/Loyalsoldier/clash-rules) |
439 | | -- [@Loyalsoldier/surge-rules](https://github.com/Loyalsoldier/surge-rules) |
440 | | - |
441 | 472 | ## 致谢 |
442 | 473 |
|
443 | 474 | - [@Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip) |
|
0 commit comments