mihomo/rules/common/final.go
adlyq 9b89ff9f2d 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
2022-09-06 17:30:35 +08:00

35 lines
499 B
Go

package common
import (
C "github.com/Dreamacro/clash/constant"
)
type Match struct {
*Base
adapter string
}
func (f *Match) RuleType() C.RuleType {
return C.MATCH
}
func (f *Match) Match(metadata *C.Metadata) (bool, string) {
return true, f.adapter
}
func (f *Match) Adapter() string {
return f.adapter
}
func (f *Match) Payload() string {
return ""
}
func NewMatch(adapter string) *Match {
return &Match{
Base: &Base{},
adapter: adapter,
}
}
//var _ C.Rule = (*Match)(nil)