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

@ -13,8 +13,8 @@ func (f *Match) RuleType() C.RuleType {
return C.MATCH
}
func (f *Match) Match(metadata *C.Metadata) bool {
return true
func (f *Match) Match(metadata *C.Metadata) (bool, string) {
return true, f.adapter
}
func (f *Match) Adapter() string {
@ -32,4 +32,4 @@ func NewMatch(adapter string) *Match {
}
}
var _ C.Rule = (*Match)(nil)
//var _ C.Rule = (*Match)(nil)