From 0926b29dea9d2c8a8c0aa3f013352d94ada0ba00 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Tue, 3 May 2022 01:36:03 +0800 Subject: [PATCH] feat: rule-provider support NetWork rule --- rule/parser.go | 8 ++++---- rule/provider/parse.go | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rule/parser.go b/rule/parser.go index a14fe16b..05595c10 100644 --- a/rule/parser.go +++ b/rule/parser.go @@ -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) } diff --git a/rule/provider/parse.go b/rule/provider/parse.go index 4dc81f90..c520b53f 100644 --- a/rule/provider/parse.go +++ b/rule/provider/parse.go @@ -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) }