2018-06-10 22:50:03 +08:00
|
|
|
package constant
|
|
|
|
|
|
|
|
// Rule Type
|
|
|
|
const (
|
|
|
|
DomainSuffix RuleType = iota
|
|
|
|
DomainKeyword
|
|
|
|
GEOIP
|
|
|
|
IPCIDR
|
|
|
|
FINAL
|
|
|
|
)
|
|
|
|
|
|
|
|
type RuleType int
|
|
|
|
|
2018-06-20 22:41:02 +08:00
|
|
|
func (rt RuleType) String() string {
|
|
|
|
switch rt {
|
|
|
|
case DomainSuffix:
|
|
|
|
return "DomainSuffix"
|
|
|
|
case DomainKeyword:
|
|
|
|
return "DomainKeyword"
|
|
|
|
case GEOIP:
|
|
|
|
return "GEOIP"
|
|
|
|
case IPCIDR:
|
|
|
|
return "IPCIDR"
|
|
|
|
case FINAL:
|
|
|
|
return "FINAL"
|
|
|
|
default:
|
|
|
|
return "Unknow"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-10 22:50:03 +08:00
|
|
|
type Rule interface {
|
|
|
|
RuleType() RuleType
|
|
|
|
IsMatch(addr *Addr) bool
|
|
|
|
Adapter() string
|
2018-06-20 22:41:02 +08:00
|
|
|
Payload() string
|
2018-06-10 22:50:03 +08:00
|
|
|
}
|