feat: rule-provider support NetWork rule

This commit is contained in:
gVisor bot 2022-05-03 01:36:03 +08:00
parent a2c489aa7f
commit 0926b29dea
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)
case "PROCESS-PATH":
parsed, parseErr = RC.NewProcess(payload, target, false)
case "MATCH":
parsed = RC.NewMatch(target)
case "RULE-SET":
parsed, parseErr = RP.NewRuleSet(payload, target)
case "NETWORK":
parsed, parseErr = RC.NewNetworkType(payload, target)
case "UID":
@ -53,6 +49,10 @@ func ParseRule(tp, payload, target string, params []string) (C.Rule, error) {
parsed, parseErr = logic.NewOR(payload, target)
case "NOT":
parsed, parseErr = logic.NewNOT(payload, target)
case "RULE-SET":
parsed, parseErr = RP.NewRuleSet(payload, target)
case "MATCH":
parsed = RC.NewMatch(target)
default:
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)
case "PROCESS-PATH":
parsed, parseErr = RC.NewProcess(payload, target, false)
case "NETWORK":
parsed, parseErr = RC.NewNetworkType(payload, target)
default:
parseErr = fmt.Errorf("unsupported rule type %s", tp)
}