规则转自:Loyalsoldier,在此基础上修改添加
本项目生成适用于 Clash Premium 的规则集(RULE-SET)。
本项目的规则集(RULE-SET)主要来源于项目 @Loyalsoldier/v2ray-rules-dat 和 @v2fly/domain-list-community;Apple
和 Google
列表里的部分域名来源于项目 @felixonmars/dnsmasq-china-list;**大陆 IPv4 地址数据使用 @17mon/china_ip_list。
本项目的规则集(RULE-SET)只适用于 Clash Premium 版本。Clash Premium 相对于普通版,增加了 TUN 增强模式,能接管设备所有 TCP 和 UDP 流量,类似 Surge for Mac 的增强模式。更多高级特性请看官方 wiki。
- Clash Premium 命令行版(兼容 Windows、macOS、Linux、OpenWRT 等多种平台):https://github.com/Dreamacro/clash/releases/tag/premium
- Clash Premium 图形用户界面版(ClashX Pro,兼容 macOS):https://install.appcenter.ms/users/clashx/apps/clashx-pro/distribution_groups/public
- Clash Premium 图形用户界面版(Clash for Windows,兼容 Windows、macOS):https://github.com/Fndroid/clash_for_windows_pkg/releases
如果无法访问域名
raw.githubusercontent.com
, 方法一:请把本地的DNS设置成电信dns114.114.114.114联通dns123.125.81.6(软路由DNS同理);如果谷歌电信DNS不能用请选择日本DNS36.2.8.242。
- 日本DNS:http://ip.yqie.com/dns_japanese.htm
- 国内DNS大全:https://dns.ip.cn/
方法二,修改系统hosts文件,添加151.101.108.133 raw.githubusercontent.com
以下地址填写在 Clash 配置文件里的
rule-providers
里的url
配置项中。
- 直连域名列表 direct.txt:
- 代理域名列表 proxy.txt:
- 广告域名列表 reject.txt:
- Apple 域名列表 apple.txt:
- iCloud 域名列表 icloud.txt:
- Google 域名列表 google.txt:
- 局域网 IP 及保留 IP 地址列表 lancidr.txt:
- **大陆 IPv4 地址列表 cncidr.txt:
- YOUTUBE 域名列表 youtube.txt:
- NETFLIX 域名列表 netflix.txt:
- NETFLIX IPv4 地址列表 netflixcidr.txt:
- GFWList 域名列表 gfw.txt:
- GreatFire 域名列表 greatfire.txt:
- 非**大陆使用的顶级域名列表 tld-not-cn.txt:
- Telegram 使用的 IP 地址列表 telegramcidr.txt:
关于 Clash Premium 使用方式,请查看官方文档 或 Lancellc's GitBook。
要想使用本项目的规则集,只需要在 Clash 配置文件中添加如下 rule-providers
和 rules
。
rule-providers:
reject:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/reject.txt"
path: ./ruleset/reject.yaml
interval: 86400
icloud:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/icloud.txt"
path: ./ruleset/icloud.yaml
interval: 86400
apple:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/apple.txt"
path: ./ruleset/apple.yaml
interval: 86400
google:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/google.txt"
path: ./ruleset/google.yaml
interval: 86400
proxy:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/proxy.txt"
path: ./ruleset/proxy.yaml
interval: 86400
direct:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/direct.txt"
path: ./ruleset/direct.yaml
interval: 86400
cncidr:
type: http
behavior: ipcidr
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/cncidr.txt"
path: ./ruleset/cncidr.yaml
interval: 86400
lancidr:
type: http
behavior: ipcidr
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/lancidr.txt"
path: ./ruleset/lancidr.yaml
interval: 86400
youtube:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/youtube.txt"
path: ./ruleset/youtube.yaml
interval: 86400
netflix:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/netflix.txt"
path: ./ruleset/netflix.yaml
interval: 86400
netflixcidr:
type: http
behavior: ipcidr
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/netflixcidr.txt"
path: ./ruleset/netflixcidr.yaml
interval: 86400
gfw:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/gfw.txt"
path: ./ruleset/gfw.yaml
interval: 86400
greatfire:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/greatfire.txt"
path: ./ruleset/greatfire.yaml
interval: 86400
tld-not-cn:
type: http
behavior: domain
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/tld-not-cn.txt"
path: ./ruleset/tld-not-cn.yaml
interval: 86400
telegramcidr:
type: http
behavior: ipcidr
url: "https://raw.githubusercontent.com/snapei/clash-pro-rules/release/telegramcidr.txt"
path: ./ruleset/telegramcidr.yaml
interval: 86400
- 以下配置中的
PROCESS-NAME
规则类型只能在 ClashX Pro 中使用,其余版本均不能使用,需要手动删除。 - 如果希望使用 DNS 来解析未命中域名类型规则的域名,而不是直接走代理,请删除
cncidr
行尾的,no-resolve
。 - 以下配置中,除了
DIRECT
和REJECT
是默认存在于 Clash 中的 policy(路由策略/流量处理策略),其余均为自定义 policy,对应配置文件中proxies
或proxy-groups
中的name
。如你直接使用下面的rules
规则,则需要在proxies
或proxy-groups
中手动配置一个name
为PROXY
的 policy。 - 如你希望 Apple、iCloud 和 Google 列表中的域名使用代理,则把 policy 由
DIRECT
改为PROXY
,以此类推,举一反三。
rules:
- PROCESS-NAME,v2ray,DIRECT
- PROCESS-NAME,Surge%203,DIRECT
- PROCESS-NAME,ss-local,DIRECT
- PROCESS-NAME,privoxy,DIRECT
- PROCESS-NAME,trojan,DIRECT
- PROCESS-NAME,trojan-go,DIRECT
- PROCESS-NAME,naive,DIRECT
- PROCESS-NAME,Thunder,DIRECT
- PROCESS-NAME,DownloadService,DIRECT
- PROCESS-NAME,qBittorrent,DIRECT
- PROCESS-NAME,Transmission,DIRECT
- PROCESS-NAME,fdm,DIRECT
- PROCESS-NAME,aria2c,DIRECT
- PROCESS-NAME,Folx,DIRECT
- PROCESS-NAME,NetTransport,DIRECT
- PROCESS-NAME,uTorrent,DIRECT
- PROCESS-NAME,WebTorrent,DIRECT
- RULE-SET,lancidr,DIRECT,no-resolve
- RULE-SET,cncidr,DIRECT,no-resolve
- RULE-SET,reject,REJECT
- RULE-SET,icloud,DIRECT
- RULE-SET,apple,DIRECT
- RULE-SET,google,GOOGLE
- RULE-SET,youtube,YOUTUBE
- RULE-SET,netflix,NETFLIX
- RULE-SET,netflixcidr,NETFLIX,no-resolve
- RULE-SET,gfw,PROXY
- RULE-SET,greatfire,PROXY
- RULE-SET,tld-not-cn,PROXY
- RULE-SET,telegramcidr,PROXY,no-resolve
- RULE-SET,proxy,PROXY
- RULE-SET,direct,DIRECT
- GEOIP,CN,DIRECT
- MATCH,PROXY