From b99b4ad15fe570d3b76ff6f3e97007e8b8447629 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Thu, 2 Dec 2021 23:32:30 +0800 Subject: [PATCH] Fixed:Rule-Set Supported RuleExtra --- rule/parser.go | 2 +- rule/rule_set.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rule/parser.go b/rule/parser.go index 6a72f52f..79c67143 100644 --- a/rule/parser.go +++ b/rule/parser.go @@ -46,7 +46,7 @@ func ParseRule(tp, payload, target string, params []string) (C.Rule, error) { case "MATCH": parsed = NewMatch(target, ruleExtra) case "RULE-SET": - parsed, parseErr = NewRuleSet(payload, target) + parsed, parseErr = NewRuleSet(payload, target, ruleExtra) default: parseErr = fmt.Errorf("unsupported rule type %s", tp) } diff --git a/rule/rule_set.go b/rule/rule_set.go index 82b03175..1815d999 100644 --- a/rule/rule_set.go +++ b/rule/rule_set.go @@ -10,6 +10,7 @@ type RuleSet struct { ruleProviderName string adapter string ruleProvider *P.RuleProvider + ruleExtra *C.RuleExtra } func (rs *RuleSet) RuleType() C.RuleType { @@ -44,7 +45,7 @@ func (rs *RuleSet) RuleExtra() *C.RuleExtra { return nil } -func NewRuleSet(ruleProviderName string, adapter string) (*RuleSet, error) { +func NewRuleSet(ruleProviderName string, adapter string, ruleExtra *C.RuleExtra) (*RuleSet, error) { rp, ok := RuleProviders()[ruleProviderName] if !ok { return nil, fmt.Errorf("rule set %s not found", ruleProviderName) @@ -53,5 +54,6 @@ func NewRuleSet(ruleProviderName string, adapter string) (*RuleSet, error) { ruleProviderName: ruleProviderName, adapter: adapter, ruleProvider: rp, + ruleExtra: ruleExtra, }, nil }