feat: rule-provider support NetWork rule

This commit is contained in:
adlyq 2022-05-03 01:36:03 +08:00
parent 259736390a
commit 52d559bb38
2 changed files with 6 additions and 4 deletions

View File

@ -39,10 +39,6 @@ func ParseRule(tp, payload, target string, params []string) (C.Rule, error) {
parsed, parseErr = RC.NewProcess(payload, target, true) parsed, parseErr = RC.NewProcess(payload, target, true)
case "PROCESS-PATH": case "PROCESS-PATH":
parsed, parseErr = RC.NewProcess(payload, target, false) parsed, parseErr = RC.NewProcess(payload, target, false)
case "MATCH":
parsed = RC.NewMatch(target)
case "RULE-SET":
parsed, parseErr = RP.NewRuleSet(payload, target)
case "NETWORK": case "NETWORK":
parsed, parseErr = RC.NewNetworkType(payload, target) parsed, parseErr = RC.NewNetworkType(payload, target)
case "UID": case "UID":
@ -53,6 +49,10 @@ func ParseRule(tp, payload, target string, params []string) (C.Rule, error) {
parsed, parseErr = logic.NewOR(payload, target) parsed, parseErr = logic.NewOR(payload, target)
case "NOT": case "NOT":
parsed, parseErr = logic.NewNOT(payload, target) parsed, parseErr = logic.NewNOT(payload, target)
case "RULE-SET":
parsed, parseErr = RP.NewRuleSet(payload, target)
case "MATCH":
parsed = RC.NewMatch(target)
default: default:
parseErr = fmt.Errorf("unsupported rule type %s", tp) parseErr = fmt.Errorf("unsupported rule type %s", tp)
} }

View File

@ -82,6 +82,8 @@ func parseRule(tp, payload, target string, params []string) (C.Rule, error) {
parsed, parseErr = RC.NewProcess(payload, target, true) parsed, parseErr = RC.NewProcess(payload, target, true)
case "PROCESS-PATH": case "PROCESS-PATH":
parsed, parseErr = RC.NewProcess(payload, target, false) parsed, parseErr = RC.NewProcess(payload, target, false)
case "NETWORK":
parsed, parseErr = RC.NewNetworkType(payload, target)
default: default:
parseErr = fmt.Errorf("unsupported rule type %s", tp) parseErr = fmt.Errorf("unsupported rule type %s", tp)
} }