mihomo/rule/common/final.go
MetaCubeX f01ac69654 Merge remote-tracking branch 'clash/dev' into Alpha
# Conflicts:
#	.github/workflows/codeql-analysis.yml
#	.github/workflows/docker.yml
#	.github/workflows/linter.yml
#	.github/workflows/stale.yml
#	Makefile
#	component/dialer/dialer.go
#	config/config.go
#	constant/metadata.go
#	constant/rule.go
#	rule/common/domain.go
#	rule/common/domain_keyword.go
#	rule/common/domain_suffix.go
#	rule/common/final.go
#	rule/common/ipcidr.go
#	rule/geoip.go
#	rule/parser.go
#	rule/port.go
#	rule/process.go
2022-03-15 23:13:41 +08:00

49 lines
733 B
Go

package common
import (
C "github.com/Dreamacro/clash/constant"
)
type Match struct {
adapter string
ruleExtra *C.RuleExtra
}
func (f *Match) RuleType() C.RuleType {
return C.MATCH
}
func (f *Match) Match(metadata *C.Metadata) bool {
return true
}
func (f *Match) Adapter() string {
return f.adapter
}
func (f *Match) Payload() string {
return ""
}
func (f *Match) ShouldResolveIP() bool {
return false
}
func (f *Match) ShouldFindProcess() bool {
return false
}
func (f *Match) RuleExtra() *C.RuleExtra {
return f.ruleExtra
}
func NewMatch(adapter string, ruleExtra *C.RuleExtra) *Match {
if ruleExtra.SourceIPs == nil {
ruleExtra = nil
}
return &Match{
adapter: adapter,
ruleExtra: ruleExtra,
}
}