pub struct ClashRuleMatcher {
pub domain_target_map: Option<HashMap<String, String>>,
pub domain_keyword_matcher: Option<DomainKeywordMatcher>,
pub domain_suffix_matcher: Option<DomainSuffixMatcher>,
pub domain_regex_set: Option<HashMap<String, RegexSet>>,
pub ip4_matcher: Option<IpMatcher>,
pub ip6_matcher: Option<Ip6Matcher>,
pub mmdb_reader: Option<Arc<Reader<Vec<u8>>>>,
pub country_target_map: Option<HashMap<String, String>>,
pub rules: Vec<(Rule, String)>,
}Expand description
convenient struct for checking all rules. init mmdb_reader using maxminddb::Reader::from_source
Fields§
§domain_target_map: Option<HashMap<String, String>>§domain_keyword_matcher: Option<DomainKeywordMatcher>§domain_suffix_matcher: Option<DomainSuffixMatcher>§domain_regex_set: Option<HashMap<String, RegexSet>>§ip4_matcher: Option<IpMatcher>§ip6_matcher: Option<Ip6Matcher>§mmdb_reader: Option<Arc<Reader<Vec<u8>>>>for GEOIP
country_target_map: Option<HashMap<String, String>>for GEOIP
rules: Vec<(Rule, String)>stores un-optimized left rules, which are AND,OR,NOT,PROCESS-NAME, DST-PORT, NETWORK,MATCH
(rule, target)
Implementations§
Source§impl ClashRuleMatcher
impl ClashRuleMatcher
pub fn from_hashmap( method_rules_map: HashMap<String, Vec<Vec<String>>>, ) -> Result<Self, ParseRuleError>
pub fn from_clash_config_str(cs: &str) -> Result<Self, Box<dyn Error>>
pub fn from_clash_config_file<P: AsRef<Path>>( path: P, ) -> Result<Self, Box<dyn Error>>
pub fn check_ip4(&self, ip: Ipv4Addr) -> Option<&String>
pub fn check_ip6(&self, ip: Ipv6Addr) -> Option<&String>
pub fn check_ip(&self, ip: IpAddr) -> Option<&String>
pub fn check_ip_country_iso(&self, ip: IpAddr) -> &str
pub fn check_ip_country(&self, ip: IpAddr) -> Option<&String>
pub fn check_domain(&self, domain: &str) -> Option<&String>
Trait Implementations§
Source§impl Debug for ClashRuleMatcher
impl Debug for ClashRuleMatcher
Source§impl Default for ClashRuleMatcher
impl Default for ClashRuleMatcher
Source§fn default() -> ClashRuleMatcher
fn default() -> ClashRuleMatcher
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ClashRuleMatcher
impl !RefUnwindSafe for ClashRuleMatcher
impl Send for ClashRuleMatcher
impl Sync for ClashRuleMatcher
impl Unpin for ClashRuleMatcher
impl UnwindSafe for ClashRuleMatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more