Fixed:Rule-Set Supported RuleExtra
This commit is contained in:
parent
6369921364
commit
b99b4ad15f
2 changed files with 4 additions and 2 deletions
|
@ -46,7 +46,7 @@ func ParseRule(tp, payload, target string, params []string) (C.Rule, error) {
|
||||||
case "MATCH":
|
case "MATCH":
|
||||||
parsed = NewMatch(target, ruleExtra)
|
parsed = NewMatch(target, ruleExtra)
|
||||||
case "RULE-SET":
|
case "RULE-SET":
|
||||||
parsed, parseErr = NewRuleSet(payload, target)
|
parsed, parseErr = NewRuleSet(payload, target, ruleExtra)
|
||||||
default:
|
default:
|
||||||
parseErr = fmt.Errorf("unsupported rule type %s", tp)
|
parseErr = fmt.Errorf("unsupported rule type %s", tp)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ type RuleSet struct {
|
||||||
ruleProviderName string
|
ruleProviderName string
|
||||||
adapter string
|
adapter string
|
||||||
ruleProvider *P.RuleProvider
|
ruleProvider *P.RuleProvider
|
||||||
|
ruleExtra *C.RuleExtra
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rs *RuleSet) RuleType() C.RuleType {
|
func (rs *RuleSet) RuleType() C.RuleType {
|
||||||
|
@ -44,7 +45,7 @@ func (rs *RuleSet) RuleExtra() *C.RuleExtra {
|
||||||
return nil
|
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]
|
rp, ok := RuleProviders()[ruleProviderName]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("rule set %s not found", ruleProviderName)
|
return nil, fmt.Errorf("rule set %s not found", ruleProviderName)
|
||||||
|
@ -53,5 +54,6 @@ func NewRuleSet(ruleProviderName string, adapter string) (*RuleSet, error) {
|
||||||
ruleProviderName: ruleProviderName,
|
ruleProviderName: ruleProviderName,
|
||||||
adapter: adapter,
|
adapter: adapter,
|
||||||
ruleProvider: rp,
|
ruleProvider: rp,
|
||||||
|
ruleExtra: ruleExtra,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue