feat: support sub-rule, eg.

rules:
  - SUB-RULE,(AND,((NETWORK,TCP),(DOMAIN-KEYWORD,google))),TEST2
  - SUB-RULE,(GEOIP,!CN),TEST1
  - MATCH,DIRECT

sub-rules:
  TEST2:
    - MATCH,Proxy
  TEST1:
    - RULE-SET,Local,DIRECT,no-resolve
    - GEOSITE,CN,Domestic
    - GEOIP,CN,Domestic
    - MATCH,Proxy
This commit is contained in:
adlyq
2022-09-06 17:30:35 +08:00
parent a9694fcdc0
commit 9b89ff9f2d
28 changed files with 325 additions and 105 deletions

View File

@ -410,8 +410,8 @@ func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) {
}
}
if rule.Match(metadata) {
adapter, ok := proxies[rule.Adapter()]
if matched, ada := rule.Match(metadata); matched {
adapter, ok := proxies[ada]
if !ok {
continue
}