Rule Sets
The rule set feature allows referencing a large number of rules with low resource consumption and supports silent updates in the background without reloading Stash. To use rule sets, you need to declare them under rule-providers
, and then reference the sets under rules
.
rule-providers:
proxy-domain:
behavior: domain # Using domain-type rule sets can improve matching efficiency
format: yaml # Use YAML format for rule sets
url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt
interval: 86400
cn-cidr:
behavior: ipcidr # Using ipcidr-type rule sets can improve matching efficiency
format: text # Use text format for rule sets
url: https://cdn.jsdelivr.net/gh/17mon/china_ip_list@master/china_ip_list.txt
interval: 86400
rules:
- RULE-SET,proxy-domain,Proxy
- RULE-SET,cn-cidr,DIRECT,no-resolve # ipcidr-type rule sets support the no-resolve parameter
Stash supports various rule set formats, each supporting different content types and exhibiting different resource usage:
Behavior | Format | Supported Content | Example | Matching Performance | Memory Usage |
---|---|---|---|---|---|
domain | yaml | Domains/Domain Wildcards | Link (opens in a new tab) | Excellent | Low |
domain | text | Domains/Domain Wildcards | Link (opens in a new tab) | Excellent | Low |
ipcidr | yaml | IPv4/IPv6 collections, CIDR format | Link (opens in a new tab) | Excellent | Low |
ipcidr | text | IPv4/IPv6 collections, CIDR format | Link (opens in a new tab) | Excellent | Low |
classical | yaml | Any rule type | Link (opens in a new tab) | Average | Average |
classical | text | Any rule type | Link (opens in a new tab) | Average | Average |
💡
Rule sets of type domain(-text)
and ipcidr(-text)
are specially compressed
and optimized for a large amount of data. It is recommended to prioritize
these when there are a lot of rule entries.
💡
Stash also supports using MRS format rule sets, currently supporting rule sets
with behavior
as domain
and ipcidr
.