Merge from remote branch

This commit is contained in:
yaling888
2021-10-28 11:36:11 +08:00
86 changed files with 1065 additions and 461 deletions

View File

@ -235,8 +235,6 @@ func (ac *ACAutomaton) Match(s string) bool {
if fullMatch {
return true
}
//default:
// //break // ineffective break statement, code "break" can not pass staticcheck check. don't sure that mean, so just block it.
}
}
return fullMatch && ac.exists[node].exist

View File

@ -68,7 +68,6 @@ func (p *Port) matchPortReal(portRef string) bool {
}
func NewPort(port string, adapter string, isSource bool, ruleExtra *C.RuleExtra) (*Port, error) {
//the port format should be like this: "123/136/137-139" or "[123]/[136-139]"
ports := strings.Split(port, "/")
if len(ports) > 28 {
return nil, fmt.Errorf("%s, too many ports to use, maximum support 28 ports", errPayload.Error())
@ -93,7 +92,6 @@ func NewPort(port string, adapter string, isSource bool, ruleExtra *C.RuleExtra)
if subPortsLen == 1 {
portList = append(portList, portReal{portStart, -1})
} else if subPortsLen == 2 {
portEnd, err1 := strconv.Atoi(strings.Trim(subPorts[1], "[ ]"))
if err1 != nil || portEnd < 0 || portEnd > 65535 {

View File

@ -24,9 +24,7 @@ func (ps *Process) RuleType() C.RuleType {
}
func (ps *Process) Match(metadata *C.Metadata) bool {
if metadata.Process != "" {
//log.Debugln("Use cache process: %s", metadata.Process)
return strings.EqualFold(metadata.Process, ps.process)
}