Feature: add DST-PORT and SRC-PORT

This commit is contained in:
Dreamacro
2019-05-09 21:00:29 +08:00
parent cff4841f3e
commit 225c530d13
17 changed files with 137 additions and 59 deletions

View File

@ -14,15 +14,15 @@ type IPCIDR struct {
func (i *IPCIDR) RuleType() C.RuleType {
if i.isSourceIP {
return C.SourceIPCIDR
return C.SrcIPCIDR
}
return C.IPCIDR
}
func (i *IPCIDR) IsMatch(metadata *C.Metadata) bool {
ip := metadata.IP
ip := metadata.DstIP
if i.isSourceIP {
ip = metadata.SourceIP
ip = metadata.SrcIP
}
return ip != nil && i.ipnet.Contains(*ip)
}