mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
63 lines
900 B
Go
63 lines
900 B
Go
package constant
|
|
|
|
// Rule Type
|
|
const (
|
|
Domain RuleType = iota
|
|
DomainSuffix
|
|
DomainKeyword
|
|
GEOSITE
|
|
GEOIP
|
|
IPCIDR
|
|
SrcIPCIDR
|
|
SrcPort
|
|
DstPort
|
|
Process
|
|
RuleSet
|
|
Script
|
|
MATCH
|
|
)
|
|
|
|
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 SrcPort:
|
|
return "SrcPort"
|
|
case DstPort:
|
|
return "DstPort"
|
|
case Process:
|
|
return "Process"
|
|
case RuleSet:
|
|
return "RuleSet"
|
|
case Script:
|
|
return "Script"
|
|
case MATCH:
|
|
return "Match"
|
|
default:
|
|
return "Unknown"
|
|
}
|
|
}
|
|
|
|
type Rule interface {
|
|
RuleType() RuleType
|
|
Match(metadata *Metadata) bool
|
|
Adapter() string
|
|
Payload() string
|
|
ShouldResolveIP() bool
|
|
RuleExtra() *RuleExtra
|
|
}
|