By using rule sets, a large number of rules can be referenced with low resource usage, and can be silently updated in the background without the need to reload Stash. To use rule sets, the declaration must be completed under
rule-provide, and then the set can be referenced under
rule-providers: proxy-domain: behavior: domain # Using domain class rule sets can make matching more efficient url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt interval: 86400 cn-cidr: behavior: ipcidr # Using ipcidr class rule sets can make matching more efficient url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt interval: 86400 rules: - RULE-SET,proxy-domain,Proxy - RULE-SET,cn-cidr,DIRECT,no-resolve # ipcidr class rule sets support the no-resolve parameter
Stash supports multiple rule set formats, which support different content and have different resource usage:
|Behavior (behavior)||Supported Content||Example||Matching Performance|
|domain||Domain / Wildcard||link (opens in a new tab)||Excellent|
|domain-text||Domain / Wildcard||link (opens in a new tab)||Excellent|
|ipcidr||IPv4 / IPv6 Set||link (opens in a new tab)||Excellent|
|ipcidr-text||IPv4 / IPv6 Set||link (opens in a new tab)||Excellent|
|classical||Any||link (opens in a new tab)||Poor|
ipcidr(-text) types of rule sets are specifically optimized for large amounts of data and are recommended for use when there are many rule entries.
It is not recommended to use the
classical rule set containing a large number of rules, as it will significantly increase Stash's memory usage.