2020-08-04 15:40:11 +08:00
|
|
|
|
# 简介
|
|
|
|
|
|
2021-03-11 16:13:11 +08:00
|
|
|
|
本项目生成适用于 [**Clash Premium 内核**](https://github.com/Dreamacro/clash/releases/tag/premium)的规则集(RULE-SET),同时适用于所有使用 Clash Premium 内核的 Clash 图形用户界面(GUI)客户端。使用 GitHub Actions 北京时间每天早上 6:30 自动构建,保证规则最新。
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
|
|
|
|
## 说明
|
|
|
|
|
|
2021-03-11 16:13:11 +08:00
|
|
|
|
本项目规则集(RULE-SET)的数据主要来源于项目 [@Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat) 和 [@v2fly/domain-list-community](https://github.com/v2fly/domain-list-community);[`Apple`](https://github.com/Loyalsoldier/clash-rules/blob/release/apple.txt) 和 [`Google`](https://github.com/Loyalsoldier/clash-rules/blob/release/google.txt) 列表里的域名来源于项目 [@felixonmars/dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list);中国大陆 IPv4 地址数据使用 [@17mon/china_ip_list](https://github.com/17mon/china_ip_list)。
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
2023-01-28 14:31:49 +08:00
|
|
|
|
本项目的规则集(RULE-SET)只适用于 Clash **Premium** 版本。Clash Premium 相对于普通版,增加了 **TUN 增强模式**,能接管设备所有 TCP 和 UDP 流量,类似 [Surge for Mac](https://nssurge.com) 的增强模式。更多高级特性请看[官方文档](https://github.com/Dreamacro/clash/wiki/Clash-Premium-Features)。
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
2021-02-20 14:48:48 +08:00
|
|
|
|
### Clash Premium 各版本下载地址
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
2021-02-20 14:48:48 +08:00
|
|
|
|
- Clash Premium **命令行**版(适用于 Windows、macOS、Linux、OpenWRT 等多种平台):[https://github.com/Dreamacro/clash/releases/tag/premium](https://github.com/Dreamacro/clash/releases/tag/premium)
|
|
|
|
|
- Clash Premium **图形用户界面**版:
|
|
|
|
|
- [ClashX Pro](https://install.appcenter.ms/users/clashx/apps/clashx-pro/distribution_groups/public)(适用于 macOS)
|
2023-01-28 14:31:49 +08:00
|
|
|
|
- [Clash for Windows](https://github.com/Fndroid/clash_for_windows_pkg/releases)(适用于 Windows、macOS、Linux)
|
2021-02-20 14:48:48 +08:00
|
|
|
|
- [Clash for Android](https://github.com/Kr328/ClashForAndroid/releases)(适用于 Android)
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
|
|
|
|
## 规则文件地址及使用方式
|
|
|
|
|
|
|
|
|
|
### 在线地址(URL)
|
|
|
|
|
|
2022-08-30 21:17:42 +08:00
|
|
|
|
> 如果无法访问域名 `raw.githubusercontent.com`,可以使用第二个地址(`cdn.jsdelivr.net`),但是内容更新会有 12 小时的延迟。以下地址填写在 Clash 配置文件里的 `rule-providers` 里的 `url` 配置项中。
|
|
|
|
|
|
|
|
|
|
- **直连域名列表 direct.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt)
|
|
|
|
|
- **代理域名列表 proxy.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt)
|
|
|
|
|
- **广告域名列表 reject.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt)
|
|
|
|
|
- **私有网络专用域名列表 private.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/private.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/private.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt)
|
|
|
|
|
- **Apple 在中国大陆可直连的域名列表 apple.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/apple.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/apple.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt)
|
|
|
|
|
- **iCloud 域名列表 icloud.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/icloud.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/icloud.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt)
|
|
|
|
|
- **[慎用]Google 在中国大陆可直连的域名列表 google.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/google.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/google.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt)
|
|
|
|
|
- **GFWList 域名列表 gfw.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/gfw.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/gfw.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt)
|
|
|
|
|
- **非中国大陆使用的顶级域名列表 tld-not-cn.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/tld-not-cn.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/tld-not-cn.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt)
|
|
|
|
|
- **Telegram 使用的 IP 地址列表 telegramcidr.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/telegramcidr.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/telegramcidr.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt)
|
|
|
|
|
- **局域网 IP 及保留 IP 地址列表 lancidr.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/lancidr.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/lancidr.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt)
|
|
|
|
|
- **中国大陆 IP 地址列表 cncidr.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/cncidr.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/cncidr.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt)
|
|
|
|
|
- **需要直连的常见软件列表 applications.txt**:
|
|
|
|
|
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/applications.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/applications.txt)
|
|
|
|
|
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt)
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
|
|
|
|
### 使用方式
|
|
|
|
|
|
2023-01-28 14:31:49 +08:00
|
|
|
|
关于 Clash Premium 使用方式,请查看[官方文档](https://github.com/Dreamacro/clash/wiki/Clash-Premium-Features) 或 [Lancellc's GitBook](https://lancellc.gitbook.io/clash/)。
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
|
|
|
|
要想使用本项目的规则集,只需要在 Clash 配置文件中添加如下 `rule-providers` 和 `rules`。
|
|
|
|
|
|
|
|
|
|
#### Rule Providers 配置方式
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
rule-providers:
|
|
|
|
|
reject:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
|
2020-08-04 15:40:11 +08:00
|
|
|
|
path: ./ruleset/reject.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
|
|
|
|
icloud:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt"
|
2020-08-04 15:40:11 +08:00
|
|
|
|
path: ./ruleset/icloud.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
|
|
|
|
apple:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt"
|
2020-08-04 15:40:11 +08:00
|
|
|
|
path: ./ruleset/apple.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
|
|
|
|
google:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
|
2020-08-04 15:40:11 +08:00
|
|
|
|
path: ./ruleset/google.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
|
|
|
|
proxy:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
|
2020-08-04 15:40:11 +08:00
|
|
|
|
path: ./ruleset/proxy.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
|
|
|
|
direct:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
|
2020-08-04 15:40:11 +08:00
|
|
|
|
path: ./ruleset/direct.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
2021-01-21 16:42:50 +08:00
|
|
|
|
private:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt"
|
2021-01-21 16:42:50 +08:00
|
|
|
|
path: ./ruleset/private.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
2020-10-30 07:06:58 +08:00
|
|
|
|
gfw:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt"
|
2020-10-30 07:06:58 +08:00
|
|
|
|
path: ./ruleset/gfw.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
|
|
|
|
tld-not-cn:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: domain
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt"
|
2020-10-30 07:06:58 +08:00
|
|
|
|
path: ./ruleset/tld-not-cn.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
2020-11-24 15:46:05 +08:00
|
|
|
|
telegramcidr:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: ipcidr
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt"
|
2020-11-24 15:46:05 +08:00
|
|
|
|
path: ./ruleset/telegramcidr.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
2020-08-04 15:40:11 +08:00
|
|
|
|
cncidr:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: ipcidr
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
|
2020-08-04 15:40:11 +08:00
|
|
|
|
path: ./ruleset/cncidr.yaml
|
|
|
|
|
interval: 86400
|
|
|
|
|
|
|
|
|
|
lancidr:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: ipcidr
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt"
|
2020-08-04 15:40:11 +08:00
|
|
|
|
path: ./ruleset/lancidr.yaml
|
|
|
|
|
interval: 86400
|
2021-11-03 19:29:07 +08:00
|
|
|
|
|
|
|
|
|
applications:
|
|
|
|
|
type: http
|
|
|
|
|
behavior: classical
|
2022-08-30 21:17:42 +08:00
|
|
|
|
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt"
|
2021-11-03 19:29:07 +08:00
|
|
|
|
path: ./ruleset/applications.yaml
|
|
|
|
|
interval: 86400
|
2020-08-04 15:40:11 +08:00
|
|
|
|
```
|
|
|
|
|
|
2020-10-30 07:06:58 +08:00
|
|
|
|
#### 白名单模式 Rules 配置方式(推荐)
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
2020-10-30 07:06:58 +08:00
|
|
|
|
- 白名单模式,意为「**没有命中规则的网络流量,统统使用代理**」,适用于服务器线路网络质量稳定、快速,不缺服务器流量的用户。
|
2020-08-04 15:40:11 +08:00
|
|
|
|
- 以下配置中,除了 `DIRECT` 和 `REJECT` 是默认存在于 Clash 中的 policy(路由策略/流量处理策略),其余均为自定义 policy,对应配置文件中 `proxies` 或 `proxy-groups` 中的 `name`。如你直接使用下面的 `rules` 规则,则需要在 `proxies` 或 `proxy-groups` 中手动配置一个 `name` 为 `PROXY` 的 policy。
|
|
|
|
|
- 如你希望 Apple、iCloud 和 Google 列表中的域名使用代理,则把 policy 由 `DIRECT` 改为 `PROXY`,以此类推,举一反三。
|
2020-10-30 07:06:58 +08:00
|
|
|
|
- 如你不希望进行 DNS 解析,可在 `GEOIP` 规则的最后加上 `,no-resolve`,如 `GEOIP,CN,DIRECT,no-resolve`。
|
2020-08-04 15:40:11 +08:00
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
rules:
|
2021-11-03 19:29:07 +08:00
|
|
|
|
- RULE-SET,applications,DIRECT
|
2020-11-04 07:49:05 +08:00
|
|
|
|
- DOMAIN,clash.razord.top,DIRECT
|
|
|
|
|
- DOMAIN,yacd.haishan.me,DIRECT
|
2021-01-21 16:42:50 +08:00
|
|
|
|
- RULE-SET,private,DIRECT
|
2020-08-04 15:40:11 +08:00
|
|
|
|
- RULE-SET,reject,REJECT
|
|
|
|
|
- RULE-SET,icloud,DIRECT
|
|
|
|
|
- RULE-SET,apple,DIRECT
|
|
|
|
|
- RULE-SET,google,DIRECT
|
|
|
|
|
- RULE-SET,proxy,PROXY
|
|
|
|
|
- RULE-SET,direct,DIRECT
|
2021-11-03 18:05:38 +08:00
|
|
|
|
- RULE-SET,lancidr,DIRECT
|
|
|
|
|
- RULE-SET,cncidr,DIRECT
|
2020-11-24 15:46:05 +08:00
|
|
|
|
- RULE-SET,telegramcidr,PROXY
|
2022-02-24 00:01:01 +08:00
|
|
|
|
- GEOIP,LAN,DIRECT
|
2020-10-30 07:06:58 +08:00
|
|
|
|
- GEOIP,CN,DIRECT
|
2020-08-04 15:40:11 +08:00
|
|
|
|
- MATCH,PROXY
|
|
|
|
|
```
|
|
|
|
|
|
2020-10-30 07:06:58 +08:00
|
|
|
|
#### 黑名单模式 Rules 配置方式
|
|
|
|
|
|
|
|
|
|
- 黑名单模式,意为「**只有命中规则的网络流量,才使用代理**」,适用于服务器线路网络质量不稳定或不够快,或服务器流量紧缺的用户。通常也是软路由用户、家庭网关用户的常用模式。
|
|
|
|
|
- 以下配置中,除了 `DIRECT` 和 `REJECT` 是默认存在于 Clash 中的 policy(路由策略/流量处理策略),其余均为自定义 policy,对应配置文件中 `proxies` 或 `proxy-groups` 中的 `name`。如你直接使用下面的 `rules` 规则,则需要在 `proxies` 或 `proxy-groups` 中手动配置一个 `name` 为 `PROXY` 的 policy。
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
rules:
|
2021-11-03 19:29:07 +08:00
|
|
|
|
- RULE-SET,applications,DIRECT
|
2020-11-04 07:49:05 +08:00
|
|
|
|
- DOMAIN,clash.razord.top,DIRECT
|
|
|
|
|
- DOMAIN,yacd.haishan.me,DIRECT
|
2021-01-21 16:42:50 +08:00
|
|
|
|
- RULE-SET,private,DIRECT
|
2020-10-30 07:06:58 +08:00
|
|
|
|
- RULE-SET,reject,REJECT
|
|
|
|
|
- RULE-SET,tld-not-cn,PROXY
|
|
|
|
|
- RULE-SET,gfw,PROXY
|
2020-11-24 15:46:05 +08:00
|
|
|
|
- RULE-SET,telegramcidr,PROXY
|
2020-10-30 07:06:58 +08:00
|
|
|
|
- MATCH,DIRECT
|
|
|
|
|
```
|
|
|
|
|
|
2020-08-04 15:40:11 +08:00
|
|
|
|
## 致谢
|
|
|
|
|
|
2021-11-03 18:05:38 +08:00
|
|
|
|
- [@Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip)
|
2020-08-04 15:40:11 +08:00
|
|
|
|
- [@Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat)
|
2020-10-30 07:06:58 +08:00
|
|
|
|
- [@gfwlist/gfwlist](https://github.com/gfwlist/gfwlist)
|
2020-08-04 15:40:11 +08:00
|
|
|
|
- [@v2fly/domain-list-community](https://github.com/v2fly/domain-list-community)
|
|
|
|
|
- [@felixonmars/dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
|
|
|
|
|
- [@17mon/china_ip_list](https://github.com/17mon/china_ip_list)
|
2021-06-21 15:12:29 +08:00
|
|
|
|
|
|
|
|
|
## 项目 Star 数增长趋势
|
|
|
|
|
|
|
|
|
|
[![Stargazers over time](https://starchart.cc/Loyalsoldier/clash-rules.svg)](https://starchart.cc/Loyalsoldier/clash-rules)
|