mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
25d6ad220d
* feat: add `DSCP` rule for Tproxy UDP packets * fix: fix compatibility issue with non_linux platform * chore: remove redundant lines for DSCP
102 lines
1.4 KiB
Go
102 lines
1.4 KiB
Go
package constant
|
|
|
|
// Rule Type
|
|
const (
|
|
Domain RuleType = iota
|
|
DomainSuffix
|
|
DomainKeyword
|
|
GEOSITE
|
|
GEOIP
|
|
IPCIDR
|
|
SrcIPCIDR
|
|
IPSuffix
|
|
SrcIPSuffix
|
|
SrcPort
|
|
DstPort
|
|
InPort
|
|
DSCP
|
|
InUser
|
|
InName
|
|
InType
|
|
Process
|
|
ProcessPath
|
|
RuleSet
|
|
Network
|
|
Uid
|
|
SubRules
|
|
MATCH
|
|
AND
|
|
OR
|
|
NOT
|
|
)
|
|
|
|
type RuleType int
|
|
|
|
func (rt RuleType) String() string {
|
|
switch rt {
|
|
case Domain:
|
|
return "Domain"
|
|
case DomainSuffix:
|
|
return "DomainSuffix"
|
|
case DomainKeyword:
|
|
return "DomainKeyword"
|
|
case GEOSITE:
|
|
return "GeoSite"
|
|
case GEOIP:
|
|
return "GeoIP"
|
|
case IPCIDR:
|
|
return "IPCIDR"
|
|
case SrcIPCIDR:
|
|
return "SrcIPCIDR"
|
|
case IPSuffix:
|
|
return "IPSuffix"
|
|
case SrcIPSuffix:
|
|
return "SrcIPSuffix"
|
|
case SrcPort:
|
|
return "SrcPort"
|
|
case DstPort:
|
|
return "DstPort"
|
|
case InPort:
|
|
return "InPort"
|
|
case InUser:
|
|
return "InUser"
|
|
case InName:
|
|
return "InName"
|
|
case InType:
|
|
return "InType"
|
|
case Process:
|
|
return "Process"
|
|
case ProcessPath:
|
|
return "ProcessPath"
|
|
case MATCH:
|
|
return "Match"
|
|
case RuleSet:
|
|
return "RuleSet"
|
|
case Network:
|
|
return "Network"
|
|
case DSCP:
|
|
return "DSCP"
|
|
case Uid:
|
|
return "Uid"
|
|
case SubRules:
|
|
return "SubRules"
|
|
case AND:
|
|
return "AND"
|
|
case OR:
|
|
return "OR"
|
|
case NOT:
|
|
return "NOT"
|
|
default:
|
|
return "Unknown"
|
|
}
|
|
}
|
|
|
|
type Rule interface {
|
|
RuleType() RuleType
|
|
Match(metadata *Metadata) (bool, string)
|
|
Adapter() string
|
|
Payload() string
|
|
ShouldResolveIP() bool
|
|
ShouldFindProcess() bool
|
|
}
|