github.com/igoogolx/clash@v1.19.8/docs/premium/rule-providers.md (about) 1 --- 2 sidebarTitle: "Feature: Rule Providers" 3 sidebarOrder: 4 4 --- 5 6 # Rule Providers 7 8 Rule Providers are pretty much the same compared to Proxy Providers. It enables users to load rules from external sources and overall cleaner configuration. This feature is currently Premium core only. 9 10 To define a Rule Provider, add the `rule-providers` field to the main configuration: 11 12 ```yaml 13 rule-providers: 14 apple: 15 behavior: "domain" # domain, ipcidr or classical (premium core only) 16 type: http 17 url: "url" 18 # format: 'yaml' # or 'text' 19 interval: 3600 20 path: ./apple.yaml 21 microsoft: 22 behavior: "domain" 23 type: file 24 path: /microsoft.yaml 25 26 rules: 27 - RULE-SET,apple,REJECT 28 - RULE-SET,microsoft,policy 29 ``` 30 31 There are three behavior types available: 32 33 ## `domain` 34 35 yaml: 36 37 ```yaml 38 payload: 39 - '.blogger.com' 40 - '*.*.microsoft.com' 41 - 'books.itunes.apple.com' 42 ``` 43 44 text: 45 46 ```txt 47 # comment 48 .blogger.com 49 *.*.microsoft.com 50 books.itunes.apple.com 51 ``` 52 53 ## `ipcidr` 54 55 yaml 56 57 ```yaml 58 payload: 59 - '192.168.1.0/24' 60 - '10.0.0.0.1/32' 61 ``` 62 63 text: 64 65 ```txt 66 # comment 67 192.168.1.0/24 68 10.0.0.0.1/32 69 ``` 70 71 ## `classical` 72 73 yaml: 74 75 ```yaml 76 payload: 77 - DOMAIN-SUFFIX,google.com 78 - DOMAIN-KEYWORD,google 79 - DOMAIN,ad.com 80 - SRC-IP-CIDR,192.168.1.201/32 81 - IP-CIDR,127.0.0.0/8 82 - GEOIP,CN 83 - DST-PORT,80 84 - SRC-PORT,7777 85 # MATCH is not necessary here 86 ``` 87 88 text: 89 90 ```txt 91 # comment 92 DOMAIN-SUFFIX,google.com 93 DOMAIN-KEYWORD,google 94 DOMAIN,ad.com 95 SRC-IP-CIDR,192.168.1.201/32 96 IP-CIDR,127.0.0.0/8 97 GEOIP,CN 98 DST-PORT,80 99 SRC-PORT,7777 100 ```