mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-02 18:14:01 +00:00
48 lines
685 B
Go
48 lines
685 B
Go
package constant
|
|
|
|
// Rule Type
|
|
const (
|
|
Domain RuleType = iota
|
|
DomainSuffix
|
|
DomainKeyword
|
|
GEOIP
|
|
IPCIDR
|
|
SrcIPCIDR
|
|
SrcPort
|
|
DstPort
|
|
MATCH
|
|
)
|
|
|
|
type RuleType int
|
|
|
|
func (rt RuleType) String() string {
|
|
switch rt {
|
|
case Domain:
|
|
return "Domain"
|
|
case DomainSuffix:
|
|
return "DomainSuffix"
|
|
case DomainKeyword:
|
|
return "DomainKeyword"
|
|
case GEOIP:
|
|
return "GEOIP"
|
|
case IPCIDR:
|
|
return "IPCIDR"
|
|
case SrcIPCIDR:
|
|
return "SrcIPCIDR"
|
|
case SrcPort:
|
|
return "SrcPort"
|
|
case DstPort:
|
|
return "DstPort"
|
|
case MATCH:
|
|
return "MATCH"
|
|
default:
|
|
return "Unknown"
|
|
}
|
|
}
|
|
|
|
type Rule interface {
|
|
RuleType() RuleType
|
|
IsMatch(metadata *Metadata) bool
|
|
Adapter() string
|
|
Payload() string
|
|
}
|