mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 21:51:23 +08:00
8595d6c2e9
1.Add Network rule, match network type(TCP/UDP) 2.Add logic rules(NOT,OR,AND) -AND,((DOMAIN,baidu.com),(NETWORK,UDP)),REJECT (cherry picked from commit d7092e2e37f2c48282c878edea1b2ebc2912b09a)
45 lines
673 B
Go
45 lines
673 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) 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,
|
|
}
|
|
}
|