| Crates.io | clash_rules |
| lib.rs | clash_rules |
| version | 0.1.19 |
| created_at | 2025-02-10 06:40:29.927004+00 |
| updated_at | 2025-02-23 12:50:10.410811+00 |
| description | a clash yaml rule parser and matching algorithms provider |
| homepage | https://github.com/e1732a364fed/clash_rules |
| repository | https://github.com/e1732a364fed/clash_rules |
| max_upload_size | |
| id | 1549701 |
| size | 450,930 |
This project can parse the rules and rule-sets in Clash’s YAML configuration files and provides an optimized matching algorithm. The project uses functional programming.
DOMAIN-SUFFIX, IP-CIDR(6) uses radix trie ,DOMAIN-KEYWORD uses Aho-Corasick Automaton. DOMAIN-REGEX uses RegexSet. PORT uses binary search.
For examples, see the test at the end of the lib.rs and benches/algorithms.
There's a convenient struct ClashRuleMatcher and an enum Rule.
Also has feature to load and save to sqlite.
Supported rules are: RULE-SET, GEOSITE, AND, OR, NOT, DOMAIN, DOMAIN-KEYWORD, DOMAIN-SUFFIX, DOMAIN-REGEX, IP-CIDR, IP-CIDR6, GEOIP, PROCESS-NAME, NETWORK, DST-PORT, SRC-PORT, IN-PORT, MATCH
Use external crate geosite-rs to support GEOSITE.