Crate clash_rules
Source pub use maxminddb;pub use rusqlite;pub use serde_yaml_ng;
- 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
- 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
- RuleInput
- RuleSet
- Trie
- Data-structure for storing and querying string-like keys and associated values.
- LoadYamlFileError
- ParseRuleError
- Rule
- AND
- DOMAIN
- DOMAIN_KEYWORD
- DOMAIN_REGEX
- DOMAIN_SUFFIX
- DST_PORT
- GEOIP
- IP_CIDR
- IP_CIDR6
- MATCH
- NETWORK
- NOT
- OR
- PROCESS_NAME
- RULE_TYPES
- sqlite 格式中目前支持的clash 规则名
- TrieCommon
- Common functionality available for tries and subtries.
- add_rule
- 新增规则
- 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
- delete_rule
- 删除规则(根据内容删除)
- 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
- 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_domain_rules
- get_ip6_cidr_rules
- get_ip_cidr_rules
- get_ip_iso_by_reader
- https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
- get_item_target_map
- for DOMAIN, PROCESS-NAME etc. that matches directly
- get_keyword_rules
- get_keywords_targets
- get_suffix_rules
- get_target_item_map
- for SUFFIX, KEYWORD,CIDR etc. that require iter.
- init_db
- 初始化 SQLite 数据库,为每种规则类型创建一个独立的表
- load_from_sqlite
- 从 SQLite 读取数据,并转换为 HashMap<String, Vec<Vec>> 格式
- load_rule_set_from_file
- load_rule_set_from_str
- load_rules_from_file
- load_rules_from_str
- merge_databases
- 将
db2.sqlite 的数据合并到 db1.sqlite - merge_method_rules_map
- parse_rule
- eg: DOMAIN-KEYWORD,bili
eg: AND,((DOMAIN-KEYWORD,bili),(DOMAIN-REGEX,(?i)pcdn|mcdn))
- 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
- query_rule
- 查询特定规则类型的所有数据
- query_rules_view
- query from all rule tables
- save_to_sqlite
- 将 HashMap<String, Vec<Vec>> 存入 SQLite,使用多个表
- to_clash_rule_name
- to_sql_table_name
- update_rule
- 更新规则(修改目标标签)