2020-06-22 17:54:51 +08:00
# 简介
2019-12-11 06:37:36 +08:00
2021-02-19 07:15:08 +08:00
[**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 )。利用 GitHub Actions 北京时间每天早上 6 点自动构建,保证规则最新。
2019-12-11 06:37:36 +08:00
## 规则文件生成方式
### geoip.dat
2020-04-02 23:35:50 +08:00
- 通过仓库 [@Loyalsoldier/geoip ](https://github.com/Loyalsoldier/geoip ) 生成
2020-11-19 02:30:59 +08:00
- 其中全球 IP 地址( IPv4 和 IPv6) 来源于 [MaxMind GeoLite2 ](https://dev.maxmind.com/geoip/geoip2/geolite2/ ), `CN`(中国大陆)类别下的 IPv4 地址来源于 [ipip.net ](https://github.com/17mon/china_ip_list )
2021-06-02 18:16:57 +08:00
- 新增类别(方便有特殊需求的用户使用):
- `geoip:cloudflare`
2021-06-21 14:51:56 +08:00
- `geoip:cloudfront`
2021-08-08 14:09:15 +08:00
- `geoip:facebook`
2021-06-21 14:51:56 +08:00
- `geoip:fastly`
2021-07-05 02:20:03 +08:00
- `geoip:netflix`
2021-06-02 18:16:57 +08:00
- `geoip:telegram`
2019-12-11 06:37:36 +08:00
2021-03-11 09:07:19 +08:00
> 希望定制 `geoip.dat` 文件?查看仓库 [@Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip)。
2021-03-05 16:55:14 +08:00
2019-12-11 06:37:36 +08:00
### geosite.dat
2020-10-27 09:33:15 +08:00
- 基于 [@v2fly/domain-list-community/data ](https://github.com/v2fly/domain-list-community/tree/master/data ) 数据,通过仓库 [@Loyalsoldier/domain-list-custom ](https://github.com/Loyalsoldier/domain-list-custom ) 生成
2020-04-07 15:15:20 +08:00
- **加入大量中国大陆域名、Apple 域名和 Google 域名**:
2020-01-27 14:33:05 +08:00
- [@felixonmars/dnsmasq-china-list/accelerated-domains.china.conf ](https://github.com/felixonmars/dnsmasq-china-list/blob/master/accelerated-domains.china.conf ) 加入到 `geosite:cn` 类别中
2020-06-10 15:13:52 +08:00
- [@felixonmars/dnsmasq-china-list/apple.china.conf ](https://github.com/felixonmars/dnsmasq-china-list/blob/master/apple.china.conf ) 加入到 `geosite:geolocation-!cn` 类别中(如希望本文件中的 Apple 域名直连,请参考下面 [geosite 的 Routing 配置方式 ](https://github.com/Loyalsoldier/v2ray-rules-dat#geositedat-1 ))
- [@felixonmars/dnsmasq-china-list/google.china.conf ](https://github.com/felixonmars/dnsmasq-china-list/blob/master/google.china.conf ) 加入到 `geosite:geolocation-!cn` 类别中(如希望本文件中的 Google 域名直连,请参考下面 [geosite 的 Routing 配置方式 ](https://github.com/Loyalsoldier/v2ray-rules-dat#geositedat-1 ))
2020-10-29 03:25:52 +08:00
- **加入 GFWList 域名**:
2020-12-27 17:14:27 +08:00
- 基于 [@gfwlist/gfwlist ](https://github.com/gfwlist/gfwlist ) 数据,通过仓库 [@cokebar/gfwlist2dnsmasq ](https://github.com/cokebar/gfwlist2dnsmasq ) 和 [@pexcn/gfwlist-extras ](https://github.com/pexcn/gfwlist-extras ) 生成
- 加入到 `geosite:gfw` 类别中,供习惯于 PAC 模式并希望使用 [GFWList ](https://github.com/gfwlist/gfwlist ) 的用户使用
2020-10-29 03:25:52 +08:00
- 同时加入到 `geosite:geolocation-!cn` 类别中
- **加入 Greatfire Analyzer 检测到的屏蔽域名**:
- 通过仓库 [@Loyalsoldier/cn-blocked-domain ](https://github.com/Loyalsoldier/cn-blocked-domain ) 获取 [Greatfire Analyzer ](https://zh.greatfire.org/analyzer ) 检测到的在中国大陆被屏蔽的域名
- 加入到 `geosite:greatfire` 类别中,可与上面的 `geosite:gfw` 类别同时使用,以达到域名黑名单的效果
- 同时加入到 `geosite:geolocation-!cn` 类别中
2020-08-03 23:11:00 +08:00
- **加入 EasyList 和 EasyListChina 广告域名**:通过 [@AdblockPlus/EasylistChina+Easylist.txt ](https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt ) 获取并加入到 `geosite:category-ads-all` 类别中
2020-08-09 11:16:09 +08:00
- **加入 AdGuard DNS Filter 广告域名**:通过 [@AdGuard/DNS-filter ](https://kb.adguard.com/en/general/adguard-ad-filters#dns-filter ) 获取并加入到 `geosite:category-ads-all` 类别中
2020-08-07 05:59:47 +08:00
- **加入 Peter Lowe 广告和隐私跟踪域名**:通过 [@PeterLowe/adservers ](https://pgl.yoyo.org/adservers ) 获取并加入到 `geosite:category-ads-all` 类别中
2020-08-11 21:04:14 +08:00
- **加入 Dan Pollock 广告域名**:通过 [@DanPollock/hosts ](https://someonewhocares.org/hosts ) 获取并加入到 `geosite:category-ads-all` 类别中
2021-01-18 16:56:18 +08:00
- **加入 Windows 操作系统相关的系统升级和隐私跟踪域名**:
- 基于 [@crazy-max/WindowsSpyBlocker ](https://github.com/crazy-max/WindowsSpyBlocker/tree/master/data/hosts ) 数据
2021-02-26 19:36:40 +08:00
- [**慎用**] Windows 操作系统使用的隐私跟踪域名 [@crazy-max/WindowsSpyBlocker/hosts/spy.txt ](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/data/hosts/spy.txt ) 加入到 `geosite:win-spy` 类别中
2021-01-18 16:56:18 +08:00
- [**慎用**] Windows 操作系统使用的系统升级域名 [@crazy-max/WindowsSpyBlocker/hosts/update.txt ](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/data/hosts/update.txt ) 加入到 `geosite:win-update` 类别中
- [**慎用**] Windows 操作系统附加的隐私跟踪域名 [@crazy-max/WindowsSpyBlocker/hosts/extra.txt ](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/data/hosts/extra.txt ) 加入到 `geosite:win-extra` 类别中
- 关于这三个类别的使用方式,请参考下面 [geosite 的 Routing 配置方式 ](https://github.com/Loyalsoldier/v2ray-rules-dat#geositedat-1 )
2021-03-05 17:16:41 +08:00
- **加入更多代理域名**:通过仓库 [@lhie1/Rules ](https://github.com/lhie1/Rules/tree/master ) 获取更多代理域名,并加入到 `geosite:geolocation-!cn` 类别中
2020-04-09 08:57:37 +08:00
- **可添加自定义直连、代理和广告域名**:由于上游域名列表更新缓慢或缺失某些域名,所以引入**需要添加的域名**列表。[`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` 类别中
- **可移除自定义直连、代理和广告域名**:由于上游域名列表存在需要被移除的域名,所以引入**需要移除的域名**列表。[`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` (广告域名列表) 移除的域名
2019-12-11 06:37:36 +08:00
2019-12-23 21:33:58 +08:00
## 规则文件下载及使用方式
2019-12-11 06:37:36 +08:00
2019-12-23 21:33:58 +08:00
**下载地址**:
2019-12-23 21:21:52 +08:00
2020-08-30 07:32:15 +08:00
> 如果无法访问域名 `raw.githubusercontent.com`,可以使用第二个地址(`cdn.jsdelivr.net`),但是内容更新会有 12 小时的延迟。
- **geoip.dat**:
2021-02-20 17:49:14 +08:00
- [https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat ](https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat )
2020-08-30 07:32:15 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat )
- **geosite.dat**:
2021-02-20 17:49:14 +08:00
- [https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat ](https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat )
2020-08-30 07:32:15 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat )
- **直连域名列表 direct-list.txt**:
2020-10-30 09:56:03 +08:00
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt )
2020-08-30 07:32:15 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/direct-list.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/direct-list.txt )
- **代理域名列表 proxy-list.txt**:
2020-10-30 09:56:03 +08:00
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/proxy-list.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/proxy-list.txt )
2020-08-30 07:32:15 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/proxy-list.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/proxy-list.txt )
- **广告域名列表 reject-list.txt**:
2020-10-30 09:56:03 +08:00
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt )
2020-08-30 07:32:15 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/reject-list.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/reject-list.txt )
2020-10-30 09:53:49 +08:00
- **Apple 在中国大陆可直连的域名列表 apple-cn.txt**:
2020-10-30 09:56:03 +08:00
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/apple-cn.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/apple-cn.txt )
2020-10-30 09:53:49 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/apple-cn.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/apple-cn.txt )
- **Google 在中国大陆可直连的域名列表 google-cn.txt**:
2020-10-30 09:56:03 +08:00
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/google-cn.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/google-cn.txt )
2020-10-30 09:53:49 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/google-cn.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/google-cn.txt )
- **GFWList 域名列表 gfw.txt**:
2020-10-30 09:56:03 +08:00
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt )
2020-10-30 09:53:49 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt )
- **Greatfire 域名列表 greatfire.txt**:
2020-10-30 09:56:03 +08:00
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/greatfire.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/greatfire.txt )
2020-10-30 09:53:49 +08:00
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/greatfire.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/greatfire.txt )
2021-01-18 16:56:18 +08:00
- **Windows 操作系统使用的隐私跟踪域名列表 win-spy.txt**:
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-spy.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-spy.txt )
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/win-spy.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/win-spy.txt )
- **Windows 操作系统使用的系统升级域名列表 win-update.txt**:
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-update.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-update.txt )
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/win-update.txt ](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/win-update.txt )
- **Windows 操作系统使用的附加隐私跟踪域名列表 win-extra.txt**:
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-extra.txt ](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-extra.txt )
- [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 )
2019-12-23 21:21:52 +08:00
2019-12-23 21:33:58 +08:00
**使用方式**:
2021-01-28 21:25:49 +08:00
1. 安装适用于自己操作系统的客户端(推荐 [V2Ray 客户端 ](https://www.v2fly.org/awesome/tools.html#%E7%AC%AC%E4%B8%89%E6%96%B9%E5%9B%BE%E5%BD%A2%E5%AE%A2%E6%88%B7%E7%AB%AF ))
2. 下载本项目的 `geoip.dat` 和 `geosite.dat`
3. 把下载下来的 `geoip.dat` 和 `geosite.dat` 放入到客户端的规则文件目录,替换掉原来的 `geoip.dat` 和 `geosite.dat`
4. 如果使用的是 V2Ray 客户端,配置可参考下面 👇👇👇
2019-12-23 21:33:58 +08:00
## 参考配置
2019-12-11 07:09:04 +08:00
2019-12-11 06:37:36 +08:00
### geoip.dat
2020-01-27 19:10:22 +08:00
跟 V2Ray 官方 `geoip.dat` 配置方式相同。
2019-12-12 13:27:38 +08:00
2019-12-23 21:33:58 +08:00
**Routing 配置方式**:
2019-12-11 06:37:36 +08:00
2019-12-11 07:22:13 +08:00
```json
2020-02-03 00:59:29 +08:00
"routing": {
"rules": [
{
"type": "field",
"outboundTag": "Direct",
"ip": [
2020-06-10 15:18:42 +08:00
"223.5.5.5/32",
"119.29.29.29/32",
"180.76.76.76/32",
"114.114.114.114/32",
2020-02-03 00:59:29 +08:00
"geoip:cn",
"geoip:private"
]
2020-06-10 15:18:42 +08:00
},
{
"type": "field",
"outboundTag": "Proxy",
"ip": [
"1.1.1.1/32",
"1.0.0.1/32",
"8.8.8.8/32",
"8.8.4.4/32",
"geoip:us",
2021-01-26 20:41:54 +08:00
"geoip:ca",
"geoip:telegram"
2020-06-10 15:18:42 +08:00
]
2020-02-03 00:59:29 +08:00
}
]
2019-12-11 06:37:36 +08:00
}
```
### geosite.dat
2021-01-18 16:56:18 +08:00
跟 V2Ray 官方 `geosite.dat` 配置方式相同。相比官方 `geosite.dat` 文件,本项目特有的类别:
- `geosite:apple-cn` :包含 [@felixonmars/dnsmasq-china-list/apple.china.conf ](https://github.com/felixonmars/dnsmasq-china-list/blob/master/apple.china.conf ) 文件里的域名,供希望 Apple 域名直连(不走代理)的用户使用。
- `geosite:google-cn` :包含 [@felixonmars/dnsmasq-china-list/google.china.conf ](https://github.com/felixonmars/dnsmasq-china-list/blob/master/google.china.conf ) 文件里的域名,供希望 Google 域名直连(不走代理)的用户使用。
2021-02-26 19:36:40 +08:00
- [**慎用**]`geosite:win-spy`:包含 [@crazy-max/WindowsSpyBlocker/hosts/spy.txt ](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/data/hosts/spy.txt ) 文件里的域名,供希望屏蔽 Windows 操作系统隐私跟踪域名的用户使用。
2021-01-18 16:56:18 +08:00
- [**慎用**]`geosite:win-update`:包含 [@crazy-max/WindowsSpyBlocker/hosts/update.txt ](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/data/hosts/update.txt ) 文件里的域名,供希望屏蔽 Windows 操作系统自动升级的用户使用。
- [**慎用**]`geosite:win-extra`:包含 [@crazy-max/WindowsSpyBlocker/hosts/extra.txt ](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/data/hosts/extra.txt ) 文件里的域名,供希望屏蔽 Windows 操作系统附加隐私跟踪域名的用户使用。
2021-02-26 20:29:18 +08:00
> ⚠️ 注意:在 Routing 配置中,类别越靠前(上),优先级越高,所以 `geosite:apple-cn` 和 `geosite:google-cn` 要放置在 `geosite:geolocation-!cn` 前(上)面才能生效。
2021-01-18 16:56:18 +08:00
2021-02-26 20:29:18 +08:00
#### 高级用法
v2fly/domain-list-community 项目 [data ](https://github.com/v2fly/domain-list-community/tree/master/data ) 目录中某些列表里的规则会被标记诸如 `@cn` 的 attribute( 如下所示) , 意为该域名在中国大陆有接入点, 可直连。
```
steampowered.com.8686c.com @cn
steamstatic.com.8686c.com @cn
```
对于玩 Steam 国区游戏,想要直连的用户,可以设置类别 `geosite:steam@cn` 为直连,意为将 [steam ](https://github.com/v2fly/domain-list-community/blob/master/data/steam ) 列表内所有被标记了 `@cn` attribute 的规则(域名)设置为直连。同理,由于 [category-games ](https://github.com/v2fly/domain-list-community/blob/master/data/category-games ) 列表包含了 `steam` 、`ea`、`blizzard`、`epicgames` 和 `nintendo` 等常见的游戏厂商。设置类别 `geosite:category-games@cn` 为直连,即可节省大量服务器流量。
> ⚠️ 注意:在 Routing 配置中,类别越靠前(上),优先级越高,所以 `geosite:category-games@cn` 等所有带有 `@cn` attribute 的规则都要放置在 `geosite:geolocation-!cn` 前(上)面才能生效。
>
> `category-games` 列表内的规则(域名)可能会有疏漏,请留意规则命中情况。如发现遗漏,欢迎到项目 v2fly/domain-list-community 提 [issue](https://github.com/v2fly/domain-list-community/issues) 反馈。
#### 配置参考下面 👇👇👇
2019-12-11 06:37:36 +08:00
2020-10-29 03:25:52 +08:00
**白名单模式 Routing 配置方式**:
2019-12-11 06:37:36 +08:00
2019-12-11 07:22:13 +08:00
```json
2020-02-03 00:59:29 +08:00
"routing": {
"rules": [
{
"type": "field",
"outboundTag": "Reject",
2021-04-20 16:46:15 +08:00
"domain": ["geosite:category-ads-all"]
2020-02-03 00:59:29 +08:00
},
{
2020-06-10 15:13:52 +08:00
"type": "field",
"outboundTag": "Direct",
"domain": [
2020-10-30 08:44:59 +08:00
"geosite:private",
2020-06-10 15:13:52 +08:00
"geosite:apple-cn",
"geosite:google-cn",
2021-02-26 20:29:18 +08:00
"geosite:tld-cn",
"geosite:category-games@cn"
2020-06-10 15:13:52 +08:00
]
},
{
2020-02-03 00:59:29 +08:00
"type": "field",
"outboundTag": "Proxy",
2021-04-20 16:46:15 +08:00
"domain": ["geosite:geolocation-!cn"]
2020-02-03 00:59:29 +08:00
},
{
"type": "field",
"outboundTag": "Direct",
2021-04-20 16:46:15 +08:00
"domain": ["geosite:cn"]
2020-10-29 03:25:52 +08:00
},
{
2021-04-20 16:46:15 +08:00
"type": "field",
"outboundTag": "Proxy",
"network": "tcp,udp"
2020-10-29 03:25:52 +08:00
}
]
}
```
**黑名单模式 Routing 配置方式:**
```json
"routing": {
"rules": [
{
"type": "field",
"outboundTag": "Reject",
2021-04-20 16:46:15 +08:00
"domain": ["geosite:category-ads-all"]
2020-10-29 03:25:52 +08:00
},
{
"type": "field",
"outboundTag": "Proxy",
2021-04-20 16:46:15 +08:00
"domain": ["geosite:tld-!cn", "geosite:gfw", "geosite:greatfire"]
2020-10-29 03:25:52 +08:00
},
2020-11-24 15:21:46 +08:00
{
"type": "field",
"outboundTag": "Proxy",
2021-04-20 16:46:15 +08:00
"ip": ["geoip:telegram"]
2020-10-30 08:44:59 +08:00
},
2020-10-29 03:25:52 +08:00
{
2021-04-20 16:46:15 +08:00
"type": "field",
"outboundTag": "Direct",
"network": "tcp,udp"
2020-02-03 00:59:29 +08:00
}
]
2019-12-11 06:37:36 +08:00
}
```
2019-12-23 21:33:58 +08:00
**DNS 配置方式**:
2019-12-11 06:37:36 +08:00
2019-12-11 07:22:13 +08:00
```json
2020-02-03 00:59:29 +08:00
"dns": {
2021-04-20 16:46:15 +08:00
"hosts": {
"dns.google": "8.8.8.8",
"dns.pub": "119.29.29.29",
"dns.alidns.com": "223.5.5.5",
"geosite:category-ads-all": "127.0.0.1"
},
2020-02-03 00:59:29 +08:00
"servers": [
2021-04-20 16:46:15 +08:00
{
"address": "https://1.1.1.1/dns-query",
"domains": ["geosite:geolocation-!cn"],
"expectIPs": ["geoip:!cn"]
},
"8.8.8.8",
2020-02-03 00:59:29 +08:00
{
2020-07-17 22:18:25 +08:00
"address": "114.114.114.114",
2020-02-03 00:59:29 +08:00
"port": 53,
2021-04-20 16:46:15 +08:00
"domains": ["geosite:cn", "geosite:category-games@cn"],
"expectIPs": ["geoip:cn"],
"skipFallback": true
2020-02-03 00:59:29 +08:00
},
{
2021-04-20 16:46:15 +08:00
"address": "localhost",
"skipFallback": true
}
2020-02-03 00:59:29 +08:00
]
2019-12-11 06:37:36 +08:00
}
```
2019-12-31 02:33:59 +08:00
2020-08-07 07:15:13 +08:00
### 自用 V2Ray 客户端配置(仅供参考,请根据自身需求酌情修改)
2020-02-03 02:00:07 +08:00
2020-08-07 07:15:13 +08:00
注意事项:
2020-02-03 02:00:07 +08:00
2021-04-20 16:46:15 +08:00
- 由于下面客户端配置的 DNS 使用了 `skipFallback` 选项,所以必须使用 v4.37.2 或更新版本的 [V2Ray ](https://github.com/v2fly/v2ray-core/releases )
2020-07-31 04:55:49 +08:00
- 下面客户端配置使 V2Ray 在本机开启 SOCKS 代理(监听 1080 端口)和 HTTP 代理(监听 2080 端口),允许局域网内其他设备连接并使用代理
2021-04-20 16:46:15 +08:00
- BT 流量统统直连(实测依然会有部分 BT 流量走代理,如果服务商禁止 BT 下载,请不要为下载软件设置代理)
2020-02-03 02:00:07 +08:00
- 最后,不命中任何路由规则的请求和流量,统统走代理
2021-01-25 21:16:57 +08:00
- `outbounds` 里的第一个大括号内的配置,即为 V2Ray 代理服务的配置。请根据自身需求进行修改,并参照 V2Ray 官网配置文档中的 [配置 > Outbounds > OutboundObject ](https://www.v2fly.org/config/outbounds.html#outboundobject ) 部分进行补全
2020-02-03 02:00:07 +08:00
2020-02-03 02:07:23 +08:00
```json
2020-02-03 02:00:07 +08:00
{
"log": {
"loglevel": "warning"
},
"dns": {
2020-04-07 15:15:20 +08:00
"hosts": {
2020-07-31 04:55:49 +08:00
"dns.google": "8.8.8.8",
2021-04-20 16:46:15 +08:00
"dns.pub": "119.29.29.29",
"dns.alidns.com": "223.5.5.5",
"geosite:category-ads-all": "127.0.0.1"
2020-04-07 15:15:20 +08:00
},
2020-02-03 02:00:07 +08:00
"servers": [
2020-07-31 04:55:49 +08:00
{
2021-04-20 16:46:15 +08:00
"address": "https://1.1.1.1/dns-query",
"domains": ["geosite:geolocation-!cn", "geosite:google@cn"],
"expectIPs": ["geoip:!cn"]
},
"8.8.8.8",
{
"address": "114.114.114.114",
"port": 53,
2020-07-31 04:55:49 +08:00
"domains": [
2020-08-30 07:37:58 +08:00
"geosite:cn",
2021-02-26 20:29:18 +08:00
"geosite:icloud",
"geosite:category-games@cn"
2020-07-31 04:55:49 +08:00
],
2021-04-20 16:46:15 +08:00
"expectIPs": ["geoip:cn"],
"skipFallback": true
2020-07-31 04:55:49 +08:00
},
2020-02-03 02:00:07 +08:00
{
2021-04-20 16:46:15 +08:00
"address": "localhost",
"skipFallback": true
2020-02-03 02:00:07 +08:00
}
]
},
"inbounds": [
{
"protocol": "socks",
2020-07-31 04:55:49 +08:00
"listen": "0.0.0.0",
2020-02-03 02:00:07 +08:00
"port": 1080,
"tag": "Socks-In",
"settings": {
"ip": "127.0.0.1",
"udp": true,
"auth": "noauth"
},
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
},
{
"protocol": "http",
2020-07-31 04:55:49 +08:00
"listen": "0.0.0.0",
2020-02-03 02:00:07 +08:00
"port": 2080,
"tag": "Http-In",
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
}
}
],
"outbounds": [
{
2020-10-27 09:33:15 +08:00
//下面这行, 协议类别要改为socks、shadowsocks、vmess或vless等( 记得删除本行文字说明)
2020-07-08 16:50:34 +08:00
"protocol": "协议类别",
2020-02-03 02:00:07 +08:00
"settings": {},
2020-07-08 16:50:34 +08:00
//下面这行, tag的值对应Routing里的outboundTag, 这里为Proxy( 记得删除本行文字说明)
2020-02-03 02:07:23 +08:00
"tag": "Proxy",
2020-02-03 02:00:07 +08:00
"streamSettings": {},
"mux": {}
},
{
"protocol": "dns",
"tag": "Dns-Out"
},
{
"protocol": "freedom",
"tag": "Direct",
"settings": {
"domainStrategy": "UseIPv4"
}
},
{
"protocol": "blackhole",
"tag": "Reject",
"settings": {
"response": {
"type": "http"
}
}
}
],
"routing": {
2020-07-31 04:55:49 +08:00
"domainStrategy": "IPIfNonMatch",
2021-04-20 16:46:15 +08:00
"domainMatcher": "mph",
2020-02-03 02:00:07 +08:00
"rules": [
2020-03-25 15:19:39 +08:00
{
"type": "field",
"outboundTag": "Direct",
"protocol": ["bittorrent"]
},
2020-02-03 02:00:07 +08:00
{
"type": "field",
"outboundTag": "Dns-Out",
2021-04-20 16:46:15 +08:00
"inboundTag": ["Socks-In", "Http-In"],
2020-02-03 02:00:07 +08:00
"network": "udp",
"port": 53
},
{
"type": "field",
"outboundTag": "Reject",
2021-04-20 16:46:15 +08:00
"domain": ["geosite:category-ads-all"]
2020-02-03 02:00:07 +08:00
},
{
"type": "field",
"outboundTag": "Proxy",
"domain": [
2020-07-31 04:55:49 +08:00
"full:www.icloud.com",
2021-04-20 16:46:15 +08:00
"domain:icloud-content.com",
"geosite:google"
2020-02-03 02:00:07 +08:00
]
},
{
"type": "field",
"outboundTag": "Direct",
"domain": [
2020-07-31 04:55:49 +08:00
"geosite:tld-cn",
2021-02-26 20:29:18 +08:00
"geosite:icloud",
"geosite:category-games@cn"
2020-02-03 02:00:07 +08:00
]
},
{
"type": "field",
2020-07-31 04:55:49 +08:00
"outboundTag": "Proxy",
2021-04-20 16:46:15 +08:00
"domain": ["geosite:geolocation-!cn"]
2020-02-03 02:00:07 +08:00
},
{
"type": "field",
2020-07-31 04:55:49 +08:00
"outboundTag": "Direct",
2021-04-20 16:46:15 +08:00
"domain": ["geosite:cn", "geosite:private"]
2020-02-03 02:00:07 +08:00
},
{
"type": "field",
"outboundTag": "Direct",
2021-04-20 16:46:15 +08:00
"ip": ["geoip:cn", "geoip:private"]
2020-02-03 02:00:07 +08:00
},
{
"type": "field",
"outboundTag": "Proxy",
2020-03-15 12:49:39 +08:00
"network": "tcp,udp"
2020-02-03 02:00:07 +08:00
}
]
}
}
```
2020-08-07 07:15:13 +08:00
## 使用本项目的项目
- [@Loyalsoldier/clash-rules ](https://github.com/Loyalsoldier/clash-rules )
- [@Loyalsoldier/surge-rules ](https://github.com/Loyalsoldier/surge-rules )
2019-12-31 02:33:59 +08:00
## 致谢
2020-10-27 09:33:15 +08:00
- [@v2fly/geoip ](https://github.com/v2fly/geoip )
2020-07-08 16:50:34 +08:00
- [@Loyalsoldier/geoip ](https://github.com/Loyalsoldier/geoip )
2020-07-19 12:27:35 +08:00
- [@v2fly/domain-list-community ](https://github.com/v2fly/domain-list-community )
2020-10-27 09:33:15 +08:00
- [@Loyalsoldier/domain-list-custom ](https://github.com/Loyalsoldier/domain-list-custom )
2019-12-31 02:33:59 +08:00
- [@felixonmars/dnsmasq-china-list ](https://github.com/felixonmars/dnsmasq-china-list )
2020-02-25 20:26:32 +08:00
- [@gfwlist/gfwlist ](https://github.com/gfwlist/gfwlist )
2020-05-30 17:28:53 +08:00
- [@pexcn/gfwlist-extras ](https://github.com/pexcn/gfwlist-extras )
2019-12-31 02:33:59 +08:00
- [@cokebar/gfwlist2dnsmasq ](https://github.com/cokebar/gfwlist2dnsmasq )
2020-05-09 21:56:24 +08:00
- [@Loyalsoldier/cn-blocked-domain ](https://github.com/Loyalsoldier/cn-blocked-domain )
2020-01-10 17:05:54 +08:00
- [@lhie1/Rules ](https://github.com/lhie1/Rules/tree/master )
2020-08-03 23:11:00 +08:00
- [@AdblockPlus/EasylistChina+Easylist.txt ](https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt )
2020-08-09 11:16:09 +08:00
- [@AdGuard/DNS-filter ](https://kb.adguard.com/en/general/adguard-ad-filters#dns-filter )
2020-08-07 05:59:47 +08:00
- [@PeterLowe/adservers ](https://pgl.yoyo.org/adservers )
2020-08-11 21:04:14 +08:00
- [@DanPollock/hosts ](https://someonewhocares.org/hosts )
2021-01-18 16:56:18 +08:00
- [@crazy-max/WindowsSpyBlocker ](https://github.com/crazy-max/WindowsSpyBlocker )
2020-05-22 15:16:18 +08:00
## 项目 Star 数增长趋势
[![Stargazers over time ](https://starchart.cc/Loyalsoldier/v2ray-rules-dat.svg )](https://starchart.cc/Loyalsoldier/v2ray-rules-dat)