Crate clash_rules
Source pub use maxminddb;pub use rusqlite;pub use serde_yaml_ng;
- sql
- AhoCorasick
- An automaton for searching multiple strings in linear time.
- ClashRuleMatcher
- Convenient struct for checking all rules.
init mmdb_reader using maxminddb::Reader::from_source
- DomainFullMatcher
- DomainKeywordMatcher
- DomainSuffixMatcher
- Ip6Matcher
- IpMatcher
- IpTrie2
- Trie struct for Ipv4Net using radix_trie::Trie, which is a bit slower than
prefix_trie::PrifixMap
- PrefixMap
- Prefix map implemented as a prefix tree.
- RuleConfig
- Contains the clash rule lines
- RuleInput
- the struct stores all possible rule inputs for checking
- RuleSet
- Trie
- Data-structure for storing and querying string-like keys and associated values.
- LoadYamlFileError
- ParseRuleError
- Rule
- All supported clash rules
- RuleSetType
- AND
- DOMAIN
- DOMAIN_KEYWORD
- DOMAIN_REGEX
- DOMAIN_SUFFIX
- DST_PORT
- GEOIP
- IP_CIDR
- IP_CIDR6
- MATCH
- NETWORK
- NOT
- OR
- PROCESS_NAME
- RULE_TYPES
- all supported rules
- TrieCommon
- Common functionality available for tries and subtries.
- check_ip6_trie
- check_ip_trie
- check_ip_trie2
- check_keyword_ac
- check_keyword_ac2
- faster than ac, but requries an extra targets lookup vec by get_keywords_targets
- check_keyword_dummy
- check_prefix_trie
- unlike check_suffix_trie, this function matches prefix
- check_suffix_dummy
- check_suffix_trie
- the function matches suffix by reversing the domain
- gen_ip6_trie
- the function store ips in the trie with their target index of the map
- gen_ip_trie
- gen_ip_trie2
- gen_keywords_ac
- gen_keywords_ac2
- Unlike gen_keywords_ac, it stores all keywords at onces, instead of
gen one ac for each target. It then requries a target list for getting the result.
- gen_prefix_trie
- the function store domains in the trie with their target index of the map
- gen_suffix_trie
- the function store domain chars in the result trie in reversed order, and
with their target index of the map
- get_ip_iso_by_reader
- return the iso 3166 code, see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
- get_item_target_map
- for DOMAIN, PROCESS-NAME etc. that matches directly
- get_keywords_targets
- returns a vec that may contain repeat items, for ac2 matching.
- get_target_item_map
- for SUFFIX, KEYWORD,CIDR etc. that require iter.
- load_rule_set_from_file
- load_rule_set_from_str
- load_rules_from_file
- load_rules_from_str
- merge_method_rules_map
- merge two into a new one
- parse_line
- parse a single clahs rule line by spliting with ‘,’, the ‘,’ splitted items is pushed in the inner Vec
- parse_rule
- parse a clash rule line without target, mainly for logic rules.
- parse_rule_set_as_classic
- parse_rule_set_as_domain_suffix_trie
- init like: let mut trie = Trie::new();
- parse_rule_set_as_ip_cidr_trie
- init like let mut trie = PrefixMap::<Ipv4Net, usize>::new();
- parse_rules
- parse clash rules into METHOD-rules hashmap, the ‘,’ splitted items is pushed in the inner Vec
- to_clash_rule_name
- to uppercase and _ to -
- to_sql_table_name
- to lowercase and - to _