什么是 rule provider、proxy provider?
rule-provider:俗称规则集合,通过它,可以引用不同类型的在线规则集 (URL),clash 就能自动根据访问目标是否在规则集中,然后匹配到对应的规则,从而选择代理/节点或者本地网络进行访问。
proxy-provider:
特别注意:rule-provider、proxy-provider 适用于 Clash Premium 内核的规则集(RULE-SET),同时适用于所有使用 Clash Premium 内核的 Clash 图形用户界面(GUI)客户端。
rule-provider、proxy-provider 大致原理
比如: RULE-SET,telegramcidr,PROXY
- “RULE-SET”是规则集的意思
- “telegramcidr” 为规则集的名称
- “PROXY” 为代理策略组名称
意思就是当访问目标是 telegramcidr 中的IP地址时,就通过 PROXY 策略组中的节点去访问。
示例
proxy-providers:
# 配置规则参考文档: https://github.com/Dreamacro/clash/wiki/configuration
# 设置代理提供者(远程订阅地址+本地订阅文件)
proxy-providers:
foo:
type: http
path: ./profiles/proxies/foo.yaml
url: https://example-url
interval: 3600
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300
bar:
type: file
path: ./profiles/proxies/bar.yaml
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300
proxy-groups:
- name: PROXY
type: select
url: http://www.gstatic.com/generate_204
interval: 3600
use:
- foo
- bar
proxies:
- DIRECT
proxy-providers
HTTP类型
File 类型
此时的 PROXY 策略组,就包含了“ foo和 bar ”代理集中的所有节点,策略组类型为 url-test;当规则使用这个策略组时,就会自动选用延迟最低的节点。
Rule Providers 示例
# clash-rules项目提供的规则集
rule-providers:
reject:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
path: ./ruleset/reject.yaml
interval: 86400
icloud:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt"
path: ./ruleset/icloud.yaml
interval: 86400
apple:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt"
path: ./ruleset/apple.yaml
interval: 86400
google:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
path: ./ruleset/google.yaml
interval: 86400
proxy:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
path: ./ruleset/proxy.yaml
interval: 86400
direct:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
path: ./ruleset/direct.yaml
interval: 86400
private:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt"
path: ./ruleset/private.yaml
interval: 86400
gfw:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt"
path: ./ruleset/gfw.yaml
interval: 86400
greatfire:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/greatfire.txt"
path: ./ruleset/greatfire.yaml
interval: 86400
tld-not-cn:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt"
path: ./ruleset/tld-not-cn.yaml
interval: 86400
telegramcidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt"
path: ./ruleset/telegramcidr.yaml
interval: 86400
cncidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
path: ./ruleset/cncidr.yaml
interval: 86400
lancidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt"
path: ./ruleset/lancidr.yaml
interval: 86400
白名单模式 Rules 配置方式(推荐)
- 白名单模式,意为「没有命中规则的网络流量,统统使用代理」,适用于服务器线路网络质量稳定、快速,不缺服务器流量的用户。
- 以下配置中,除了
DIRECT
和REJECT
是默认存在于 Clash 中的 policy(路由策略/流量处理策略),其余均为自定义 policy,对应配置文件中proxies
或proxy-groups
中的name
。如你直接使用下面的rules
规则,则需要在proxies
或proxy-groups
中手动配置一个name
为PROXY
的 policy。 - 如你希望 Apple、iCloud 和 Google 列表中的域名使用代理,则把 policy 由
DIRECT
改为PROXY
,以此类推,举一反三。 - 如你不希望进行 DNS 解析,可在
GEOIP
规则的最后加上,no-resolve
,如GEOIP,CN,DIRECT,no-resolve
。
# “白名单模式”常见模板
rules:
- RULE-SET,applications,DIRECT
- DOMAIN,clash.razord.top,DIRECT
- DOMAIN,yacd.haishan.me,DIRECT
- RULE-SET,private,DIRECT
- RULE-SET,reject,REJECT
- RULE-SET,icloud,DIRECT
- RULE-SET,apple,DIRECT
- RULE-SET,google,DIRECT
- RULE-SET,proxy,PROXY
- RULE-SET,direct,DIRECT
- RULE-SET,lancidr,DIRECT
- RULE-SET,cncidr,DIRECT
- RULE-SET,telegramcidr,PROXY
- GEOIP,LAN,DIRECT
- GEOIP,CN,DIRECT
- MATCH,PROXY
黑名单模式 Rules 配置方式
- 黑名单模式,意为「只有命中规则的网络流量,才使用代理」,适用于服务器线路网络质量不稳定或不够快,或服务器流量紧缺的用户。通常也是软路由用户、家庭网关用户的常用模式。
- 以下配置中,除了
DIRECT
和REJECT
是默认存在于 Clash 中的 policy(路由策略/流量处理策略),其余均为自定义 policy,对应配置文件中proxies
或proxy-groups
中的name
。如你直接使用下面的rules
规则,则需要在proxies
或proxy-groups
中手动配置一个name
为PROXY
的 policy。
# “黑名单模式”常见模板
rules:
- RULE-SET,applications,DIRECT
- DOMAIN,clash.razord.top,DIRECT
- DOMAIN,yacd.haishan.me,DIRECT
- RULE-SET,private,DIRECT
- RULE-SET,reject,REJECT
- RULE-SET,tld-not-cn,PROXY
- RULE-SET,gfw,PROXY
- RULE-SET,greatfire,PROXY
- RULE-SET,telegramcidr,PROXY
- MATCH,DIRECT
配置文件范本基础版(建议新手使用): 点击跳转(备用)
mixed-port: 7890
#---------------------------------------------------#
allow-lan: false
mode: Rule
log-level: silent
external-controller: 127.0.0.1:60000
# 节点配置文件统一存放在 ./profiles/proxies/ 目录中
proxy-providers:
# 从链接导入的配置文件(支持多个Clash 订阅链接)
foo:
type: http
path: ./profiles/proxies/foo.yaml
url: https://example-url (clash 订阅链接)
interval: 3600
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300
proxy-groups:
- name: PROXY
type: url-test
url: http://www.gstatic.com/generate_204
interval: 3600
use: # 引入proxy-provider 使用 use 关键字
- foo
# clash-rules项目提供的规则集
rule-providers:
reject:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
path: ./ruleset/reject.yaml
interval: 86400
icloud:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt"
path: ./ruleset/icloud.yaml
interval: 86400
apple:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt"
path: ./ruleset/apple.yaml
interval: 86400
google:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
path: ./ruleset/google.yaml
interval: 86400
proxy:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
path: ./ruleset/proxy.yaml
interval: 86400
direct:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
path: ./ruleset/direct.yaml
interval: 86400
private:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt"
path: ./ruleset/private.yaml
interval: 86400
gfw:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt"
path: ./ruleset/gfw.yaml
interval: 86400
greatfire:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/greatfire.txt"
path: ./ruleset/greatfire.yaml
interval: 86400
tld-not-cn:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt"
path: ./ruleset/tld-not-cn.yaml
interval: 86400
telegramcidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt"
path: ./ruleset/telegramcidr.yaml
interval: 86400
cncidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
path: ./ruleset/cncidr.yaml
interval: 86400
lancidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt"
path: ./ruleset/lancidr.yaml
interval: 86400
# 分流规则
rules:
- PROCESS-NAME,xray,DIRECT
- PROCESS-NAME,v2ray,DIRECT
- PROCESS-NAME,naive,DIRECT
- PROCESS-NAME,trojan,DIRECT
- PROCESS-NAME,trojan-go,DIRECT
- PROCESS-NAME,ss-local,DIRECT
- PROCESS-NAME,privoxy,DIRECT
- PROCESS-NAME,leaf,DIRECT
- PROCESS-NAME,v2ray.exe,DIRECT
- PROCESS-NAME,xray.exe,DIRECT
- PROCESS-NAME,naive.exe,DIRECT
- PROCESS-NAME,trojan.exe,DIRECT
- PROCESS-NAME,trojan-go.exe,DIRECT
- PROCESS-NAME,ss-local.exe,DIRECT
- PROCESS-NAME,privoxy.exe,DIRECT
- PROCESS-NAME,leaf.exe,DIRECT
- PROCESS-NAME,Surge,DIRECT
- PROCESS-NAME,Surge 2,DIRECT
- PROCESS-NAME,Surge 3,DIRECT
- PROCESS-NAME,Surge 4,DIRECT
- PROCESS-NAME,Surge%202,DIRECT
- PROCESS-NAME,Surge%203,DIRECT
- PROCESS-NAME,Surge%204,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
- PROCESS-NAME,aria2c.exe,DIRECT
- PROCESS-NAME,BitComet.exe,DIRECT
- PROCESS-NAME,fdm.exe,DIRECT
- PROCESS-NAME,NetTransport.exe,DIRECT
- PROCESS-NAME,qbittorrent.exe,DIRECT
- PROCESS-NAME,Thunder.exe,DIRECT
- PROCESS-NAME,ThunderVIP.exe,DIRECT
- PROCESS-NAME,transmission-daemon.exe,DIRECT
- PROCESS-NAME,transmission-qt.exe,DIRECT
- PROCESS-NAME,uTorrent.exe,DIRECT
- PROCESS-NAME,WebTorrent.exe,DIRECT
- DOMAIN,clash.razord.top,DIRECT
- DOMAIN,yacd.haishan.me,DIRECT
- RULE-SET,private,DIRECT
- RULE-SET,reject,REJECT
- RULE-SET,icloud,DIRECT
- RULE-SET,apple,DIRECT
- RULE-SET,google,DIRECT
- RULE-SET,proxy,PROXY
- RULE-SET,direct,DIRECT
- RULE-SET,telegramcidr,PROXY
- GEOIP,LAN,DIRECT
- GEOIP,CN,DIRECT
- MATCH,PROXY
配置文件范本进阶版(白名单): 点击跳转(备用)
mixed-port: 7890
#---------------------------------------------------#
allow-lan: false
mode: Rule
log-level: silent
external-controller: 127.0.0.1:60000
# 节点配置文件统一存放在 ./profiles/proxies/ 目录中
proxy-providers:
# 从链接导入的配置文件(支持多个Clash 订阅链接)
foo:
type: http
path: ./profiles/proxies/foo.yaml
url: https://example-url (clash 订阅链接)
interval: 3600
filter: 'Hong Kong' # 删选出含有该关键词的节点
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300
# 从本地导入的 clash 配置文件
bar:
type: file
path: ./profiles/proxies/bar.yaml
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 600
proxy-groups:
- name: PROXY
type: url-test
url: http://www.gstatic.com/generate_204
interval: 3600
use: # 引入proxy-provider 使用 use 关键字
- foo
- bar
proxies:
- DIRECT
# clash-rules项目提供的规则集
rule-providers:
reject:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
path: ./ruleset/reject.yaml
interval: 86400
icloud:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt"
path: ./ruleset/icloud.yaml
interval: 86400
apple:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt"
path: ./ruleset/apple.yaml
interval: 86400
google:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
path: ./ruleset/google.yaml
interval: 86400
proxy:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
path: ./ruleset/proxy.yaml
interval: 86400
direct:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
path: ./ruleset/direct.yaml
interval: 86400
private:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt"
path: ./ruleset/private.yaml
interval: 86400
gfw:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt"
path: ./ruleset/gfw.yaml
interval: 86400
greatfire:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/greatfire.txt"
path: ./ruleset/greatfire.yaml
interval: 86400
tld-not-cn:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt"
path: ./ruleset/tld-not-cn.yaml
interval: 86400
telegramcidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt"
path: ./ruleset/telegramcidr.yaml
interval: 86400
cncidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
path: ./ruleset/cncidr.yaml
interval: 86400
lancidr:
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt"
path: ./ruleset/lancidr.yaml
interval: 86400
# 分流规则
rules:
- PROCESS-NAME,xray,DIRECT
- PROCESS-NAME,v2ray,DIRECT
- PROCESS-NAME,naive,DIRECT
- PROCESS-NAME,trojan,DIRECT
- PROCESS-NAME,trojan-go,DIRECT
- PROCESS-NAME,ss-local,DIRECT
- PROCESS-NAME,privoxy,DIRECT
- PROCESS-NAME,leaf,DIRECT
- PROCESS-NAME,v2ray.exe,DIRECT
- PROCESS-NAME,xray.exe,DIRECT
- PROCESS-NAME,naive.exe,DIRECT
- PROCESS-NAME,trojan.exe,DIRECT
- PROCESS-NAME,trojan-go.exe,DIRECT
- PROCESS-NAME,ss-local.exe,DIRECT
- PROCESS-NAME,privoxy.exe,DIRECT
- PROCESS-NAME,leaf.exe,DIRECT
- PROCESS-NAME,Surge,DIRECT
- PROCESS-NAME,Surge 2,DIRECT
- PROCESS-NAME,Surge 3,DIRECT
- PROCESS-NAME,Surge 4,DIRECT
- PROCESS-NAME,Surge%202,DIRECT
- PROCESS-NAME,Surge%203,DIRECT
- PROCESS-NAME,Surge%204,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
- PROCESS-NAME,aria2c.exe,DIRECT
- PROCESS-NAME,BitComet.exe,DIRECT
- PROCESS-NAME,fdm.exe,DIRECT
- PROCESS-NAME,NetTransport.exe,DIRECT
- PROCESS-NAME,qbittorrent.exe,DIRECT
- PROCESS-NAME,Thunder.exe,DIRECT
- PROCESS-NAME,ThunderVIP.exe,DIRECT
- PROCESS-NAME,transmission-daemon.exe,DIRECT
- PROCESS-NAME,transmission-qt.exe,DIRECT
- PROCESS-NAME,uTorrent.exe,DIRECT
- PROCESS-NAME,WebTorrent.exe,DIRECT
- DOMAIN,clash.razord.top,DIRECT
- DOMAIN,yacd.haishan.me,DIRECT
- RULE-SET,private,DIRECT
- RULE-SET,reject,REJECT
- RULE-SET,icloud,DIRECT
- RULE-SET,apple,DIRECT
- RULE-SET,google,DIRECT
- RULE-SET,proxy,PROXY
- RULE-SET,direct,DIRECT
- RULE-SET,telegramcidr,PROXY
- GEOIP,LAN,DIRECT
- GEOIP,CN,DIRECT
- MATCH,PROXY
自用的配置文件进阶版(白名单模式+YouTube+Netflix 分流规则):点击跳转(备用)
mixed-port: 7890 allow-lan: false mode: Rule log-level: silent external-controller: 127.0.0.1:60000
proxy-providers:
BL:
type: http
path: ./profiles/proxies/BL.yaml
url: "https://"
interval: 3600
filter: 'Hong Kong'
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300
KY:
type: http
path: ./profiles/proxies/KY.yaml
url: "https://"
interval: 3600
filter: 'IEPL-香港'
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300
BLSG:
type: http
path: ./profiles/proxies/BLSG.yaml
url: "https://"
interval: 3600
filter: 'Singapore'
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300
proxy-groups:
- name: PROXY
type: url-test
url: http://www.gstatic.com/generate_204
interval: 300
use:
- BL
- KY
proxies:
- DIRECT
- name: Netflix
type: url-test
url: http://www.gstatic.com/generate_204
interval: 300
use:
- BLSG
- name: Youtube
type: url-test
url: http://www.gstatic.com/generate_204
interval: 300
use:
- KY
rule-providers: reject: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt" path: ./ruleset/reject.yaml interval: 86400 icloud: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt" path: ./ruleset/icloud.yaml interval: 86400 apple: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt" path: ./ruleset/apple.yaml interval: 86400 google: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt" path: ./ruleset/google.yaml interval: 86400 proxy: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt" path: ./ruleset/proxy.yaml interval: 86400 direct: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt" path: ./ruleset/direct.yaml interval: 86400 private: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt" path: ./ruleset/private.yaml interval: 86400 gfw: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt" path: ./ruleset/gfw.yaml interval: 86400 greatfire: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/greatfire.txt" path: ./ruleset/greatfire.yaml interval: 86400 tld-not-cn: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt" path: ./ruleset/tld-not-cn.yaml interval: 86400 telegramcidr: type: http behavior: ipcidr url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt" path: ./ruleset/telegramcidr.yaml interval: 86400 cncidr: type: http behavior: ipcidr url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt" path: ./ruleset/cncidr.yaml interval: 86400 lancidr: type: http behavior: ipcidr url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt" path: ./ruleset/lancidr.yaml interval: 86400
# 分流规则
rules:
- DOMAIN-KEYWORD,youtube,Youtube
- DOMAIN,youtubei.googleapis.com,Youtube
- DOMAIN,yt3.ggpht.com,Youtube
- DOMAIN-SUFFIX,googlevideo.com,Youtube
- DOMAIN-SUFFIX,gvt2.com,Youtube
- DOMAIN-SUFFIX,withyoutube.com,Youtube
- DOMAIN-SUFFIX,youtu.be,Youtube
- DOMAIN-SUFFIX,youtube-nocookie.com,Youtube
- DOMAIN-SUFFIX,youtube.com,Youtube
- DOMAIN-SUFFIX,youtubeeducation.com,Youtube
- DOMAIN-SUFFIX,youtubegaming.com,Youtube
- DOMAIN-SUFFIX,youtubekids.com,Youtube
- DOMAIN-SUFFIX,yt.be,Youtube
- DOMAIN-SUFFIX,ytimg.com,Youtube
- DOMAIN-KEYWORD,netflixdnstest,Netflix
- DOMAIN,netflix.com.edgesuite.net,Netflix
- DOMAIN-SUFFIX,fast.com,Netflix
- DOMAIN-SUFFIX,netflix.com,Netflix
- DOMAIN-SUFFIX,netflix.net,Netflix
- DOMAIN-SUFFIX,netflixdnstest0.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest1.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest2.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest3.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest4.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest5.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest6.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest7.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest8.com,Netflix
- DOMAIN-SUFFIX,netflixdnstest9.com,Netflix
- DOMAIN-SUFFIX,nflxext.com,Netflix
- DOMAIN-SUFFIX,nflximg.com,Netflix
- DOMAIN-SUFFIX,nflximg.net,Netflix
- DOMAIN-SUFFIX,nflxso.net,Netflix
- DOMAIN-SUFFIX,nflxvideo.net,Netflix
- IP-CIDR,8.41.4.0/24,Netflix,no-resolve
- IP-CIDR,23.246.0.0/18,Netflix,no-resolve
- IP-CIDR,37.77.184.0/21,Netflix,no-resolve
- IP-CIDR,38.72.126.0/24,Netflix,no-resolve
- IP-CIDR,45.57.0.0/17,Netflix,no-resolve
- IP-CIDR,64.120.128.0/17,Netflix,no-resolve
- IP-CIDR,66.197.128.0/17,Netflix,no-resolve
- IP-CIDR,69.53.224.0/19,Netflix,no-resolve
- IP-CIDR,103.87.204.0/22,Netflix,no-resolve
- IP-CIDR,108.175.32.0/20,Netflix,no-resolve
- IP-CIDR,185.2.220.0/22,Netflix,no-resolve
- IP-CIDR,185.9.188.0/22,Netflix,no-resolve
- IP-CIDR,192.173.64.0/18,Netflix,no-resolve
- IP-CIDR,198.38.96.0/19,Netflix,no-resolve
- IP-CIDR,198.45.48.0/20,Netflix,no-resolve
- IP-CIDR,207.45.72.0/22,Netflix,no-resolve
- IP-CIDR,208.75.76.0/22,Netflix,no-resolve
- PROCESS-NAME,v2ray,DIRECT
- PROCESS-NAME,xray,DIRECT
- PROCESS-NAME,naive,DIRECT
- PROCESS-NAME,trojan,DIRECT
- PROCESS-NAME,trojan-go,DIRECT
- PROCESS-NAME,ss-local,DIRECT
- PROCESS-NAME,privoxy,DIRECT
- PROCESS-NAME,leaf,DIRECT
- PROCESS-NAME,v2ray.exe,DIRECT
- PROCESS-NAME,xray.exe,DIRECT
- PROCESS-NAME,naive.exe,DIRECT
- PROCESS-NAME,trojan.exe,DIRECT
- PROCESS-NAME,trojan-go.exe,DIRECT
- PROCESS-NAME,ss-local.exe,DIRECT
- PROCESS-NAME,privoxy.exe,DIRECT
- PROCESS-NAME,leaf.exe,DIRECT
- PROCESS-NAME,Surge,DIRECT
- PROCESS-NAME,Surge 2,DIRECT
- PROCESS-NAME,Surge 3,DIRECT
- PROCESS-NAME,Surge 4,DIRECT
- PROCESS-NAME,Surge%202,DIRECT
- PROCESS-NAME,Surge%203,DIRECT
- PROCESS-NAME,Surge%204,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
- PROCESS-NAME,aria2c.exe,DIRECT
- PROCESS-NAME,BitComet.exe,DIRECT
- PROCESS-NAME,fdm.exe,DIRECT
- PROCESS-NAME,NetTransport.exe,DIRECT
- PROCESS-NAME,qbittorrent.exe,DIRECT
- PROCESS-NAME,Thunder.exe,DIRECT
- PROCESS-NAME,ThunderVIP.exe,DIRECT
- PROCESS-NAME,transmission-daemon.exe,DIRECT
- PROCESS-NAME,transmission-qt.exe,DIRECT
- PROCESS-NAME,uTorrent.exe,DIRECT
- PROCESS-NAME,WebTorrent.exe,DIRECT
- DOMAIN,clash.razord.top,DIRECT
- DOMAIN,yacd.haishan.me,DIRECT
- RULE-SET,private,DIRECT
- RULE-SET,reject,REJECT
- RULE-SET,icloud,DIRECT
- RULE-SET,apple,DIRECT
- RULE-SET,google,DIRECT
- RULE-SET,proxy,PROXY
- RULE-SET,direct,DIRECT
- RULE-SET,telegramcidr,PROXY
- GEOIP,LAN,DIRECT
- GEOIP,CN,DIRECT
- MATCH,PROXY
参考资料(不分先后顺序):感谢各位大佬的无私分享
- 科学上网工具-免费的Clash代理工具使用、配置及需要避免的坑经验总结 – 小V爱折腾 (vlike.work)
- https://github.com/Loyalsoldier/clash-rules
- https://gist.github.com/ricky9w/31fffc1b6eadadba2603f323dc92bebf
- https://github.com/Dreamacro/clash/wiki/configuration#proxy-groups
延伸阅读: proxy-provider 如何添加自建节点
留言
怎么添加自建节点?试了半天,不是错误,就是无法引用
很简单,把自建节点通过订阅转换链接网站转换成clash 订阅链接就可以了
请问一下 “filter“ 怎么用做排除啊?
filter 不能做排除
`filter` 支持正则表达式,排除的语法是: ‘^(?!.*(日本|香港|新加坡|美国)).*’ 把国家换成你要排除的即可
initial proxy provider xxx error: yaml: unmarshal errors: line 1: cannot unmarshal !!str `dm1lc3M…` into provider.ProxySchema 我的服务的 clash 订阅链接好像对内容做了转化,没办法用 type: http的方式把它转化过来。 但是 Clash Pro 的托管配置功能又可以把他转化成 yaml 文件,就很迷茫。 暂时用type: http方式去引用转化好的 yaml 文件。。。 求指教更优雅的方式。
更正:type: file方式去引用转化好的 yaml 文件。。。
在m2 macmini上遇到同样的问题。感谢你的用法启发,用file方式引用yaml暂时用起来了。
对,个人建议去网上找一找clash订阅链接转换网站,转换后,再试试看
貌似 Clash 不能解析在这里填的链接,只能用 Clash 的配置文件。我的处理方式是在本地用 subconverter 转换,链接就填转换的链接。如果没有什么特别需求的话,链接是 http://127.0.0.1:25500/sub?target=clash&url=订阅链接 缺点是要保持 subconverter 开启。如果觉得它的窗口碍事的话,可以移动到另一个桌面。除此之外,和直接成功用机场给的链接差不多,算是比较优雅的方式了。
错误提示:initial proxy provider pqjc error: yaml: unmarshal errors: line 1: cannot unmarshal !!str dHJvamF… into provider.ProxySchema 原因:因订阅地址后面 token 一般使用 BASE64 编码,Clash 无法识别 解决方式:订阅地址加 &flag=clash,示例:https://gtoken=82ec7c3&flag=clash
为什么 groups 里面一定得带一个 name 为 PROXY 的,看其它机场节点并没有这样
那是因为,默认的分流规则,引用了name 为 PROXY的策略组;不建议修改
备忘:proxy-providers Http 的 Path 需要先到指定目录新建好才可以
不会吧?客户端,应该会自动新建一个文件夹并把对应的http 包含的配置文件下载到该文件夹
proxy-groups: – name: PROXY 这个为什么不能剔除啊
问题反馈: Clash Premium版本:2022.11.25 Premium (14324) 当前版本,rule-providers下的每个RULE-SET项下的path好像是无效了,会自动下载到”C:\Users\\.config\clash\providers\rule”这个目录下,无法更改路径,并且自动以一串哈希值命名,无法自定义文件名(如”gfw.yaml”)。 另,同理,proxy-providers下的每个机场的配置项下的path也无法自定义,被自动下载到”C:\Users\\.config\clash\providers\proxy”目录中,并自动以一串哈希值命名配置文件,而无法自定义文件名(如”BL.yaml”)。
建议卸载客户端后,重新安装,CFW 有版本更新了配置文件和规则集文件,默认的文件位置
当我配置里直接使用http会创建一个providers文件夹在里面创建规则&订阅,但是生成的是一串哈希值,当我将http改为file就需要在设置的路径已有对应的文件。请问一下这个可以解决吗?
以前一直用的好好的,但是前几个月clash更新一次后到现在 provider一直无法更新,提示clash initial proxy provider file must have a proxies field,找了很多资料找不到原因了
请教一下,如何在proxy-groups里过滤某个proxy-provider的订阅节点?
`filter` 字段去删选 节点名称;比如说,你想用节点名含有 Singapore 字样, proxy-groups: – name: PROXY type: url-test url: http://www.gstatic.com/generate_204 interval: 300 filter: ‘Singapore’ use: – BL – KY
你好,我用 clash verge 按以下配置,老是报错:proxy group[0]: PROXY ‘🇭🇰 Hong Kong丨01’ not found, 请指导下是什么问题? 配置如下: proxy-providers: sub1: type: http path: ./profiles/proxies/suba.yaml url: https://subaxxxxx.com?token=xxxxx interval: 86400 health-check: enable: true url: http://www.gstatic.com/generate_204 interval: 3600 proxy-groups: – name: PROXY type: select use: – suba proxies: – 🇭🇰 Hong Kong丨01 suba.yaml里面proxies如下(部分内容): proxies: – { name: ‘🇭🇰 Hong Kong丨01’, type: ss, server: xxx, port: ‘16001’, cipher: aes-256-gcm, password: xxx, udp: true } 如下,如果 proxy-groups 里面使用 filter 是没问题的 proxy-groups: – name: PROXY type: select use: – suba filter: ‘🇭🇰’ 我比较疑惑的是,看文档不是说可以直接在 proxy-groups 中制定 proxy-provider 提供的单个 proxies 节点吗?
不对,请参考以下配置文件。正确的操作不走是: 1.在 proxy-provider 前,单独新建一个 proxies 的代理集 2. 按照clash的节点格式要求,依次添加新节点。 3.在 proxygroups中的 proxies 去依次添加节点名称,以便引用新加的节点。 配置文件范本: mixed-port: 7890 allow-lan: false mode: Rule log-level: silent external-controller: 127.0.0.1:60000 proxies: – name: Hong Kong 01 type: ss server: 107.xxx.xx.xxx port: “1xx8” cipher: aes-256-gcm password: YRQxxxxx – name: Hong Kong 02 type: ss server: 038b8xxxol port: “xxx” cipher: aes-128-gcm password: 3649xxxx udp: true protocol: origin – name: Hong Kong 03 type: ss server: 03xx0.xx.lol port: “4xxx1” cipher: aes-128-gcm password: 364xxxxx udp: true protocol: origin proxy-providers: KY: type: http path: ./profiles/proxies/KY.yaml url: https://api.xxxxx interval: 3600 filter: IEPL-香港 health-check: enable: true url: http://www.youtube.com interval: 300 proxy-groups: – name: PROXY type: select url: http://www.youtube.com interval: 600 use: – KY proxies: – Hong Kong 01 – Hong Kong 02 – Hong Kong 03
请问 proxies下的bar.yaml文件 长什么样子啊,能分享一下吗, 假如我想让 openai.com 固定走美国的节点,这个文件如何编辑
可以先看看这个直播视频:https://www.youtube.com/live/8OTTEbbA6yI?si=_Z88D0O3NZx6Uel4&t=1341 关于 openai.COM 固定走美国的节点,请参照这个博客:https://jamesdaily.life/clash_2022 ;也可以加入电报群提问:https://bit.ly/tel_j
麻烦问下为什么每个proxy-providers 和 rule-providers 下的 path : 例如: path: ./profiles/proxies/providers1.yml ,最终下载到的节点信息或者规则集信息 保存的文件名称不是provicers1.yml ,而是一串数字.yaml, 但是又不影响使用,这个是怎么回事
你理解到的文件路径不太正确,准确的是 proxy-providers 和 rule-providers 下的 path,为客户端的配置文件—点击鼠标右键 “ show in folder”–点击文件夹“ proxies ”或“ rules“,你再核对下
cfw 使用rule-provider 、proxy-provider。请问怎么让自行添加的规则覆盖掉在线规则。如bing,在线规则直连,但想要添加条自定义规则,使用代理访问