本文最后更新于 2025-03-07T12:25:01+00:00
Rule Providers 规则集
Rule Providers 规则集和 Proxy Providers 代理集 基本相同. 它允许用户从外部源加载规则, 从而使配置更加简洁. 该功能目前仅适用于 Clash Premium 内核.
要定义 Rule Providers 规则集, 请将 rule-providers
规则集字段添加到主配置中:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| rule-providers: apple: behavior: "domain" type: http url: "url" interval: 3600 path: ./apple.yaml microsoft: behavior: "domain" type: file path: /microsoft.yaml
rules: - RULE-SET,apple,REJECT - RULE-SET,microsoft,policy
|
有三种行为类型可用:
domain
yaml:
1 2 3 4
| payload: - '.blogger.com' - '*.*.microsoft.com' - 'books.itunes.apple.com'
|
text:
1 2 3 4
| # comment .blogger.com *.*.microsoft.com books.itunes.apple.com
|
ipcidr
yaml:
1 2 3
| payload: - '192.168.1.0/24' - '10.0.0.0.1/32'
|
text:
1 2 3
| # comment 192.168.1.0/24 10.0.0.0.1/32
|
classical
yaml:
1 2 3 4 5 6 7 8 9 10
| payload: - DOMAIN-SUFFIX,google.com - DOMAIN-KEYWORD,google - DOMAIN,ad.com - SRC-IP-CIDR,192.168.1.201/32 - IP-CIDR,127.0.0.0/8 - GEOIP,CN - DST-PORT,80 - SRC-PORT,7777
|
text:
1 2 3 4 5 6 7 8 9
| # comment DOMAIN-SUFFIX,google.com DOMAIN-KEYWORD,google DOMAIN,ad.com SRC-IP-CIDR,192.168.1.201/32 IP-CIDR,127.0.0.0/8 GEOIP,CN DST-PORT,80 SRC-PORT,7777
|