diff --git a/internal/waf/rule_set.go b/internal/waf/rule_set.go index b3f1b2d..2e2274a 100644 --- a/internal/waf/rule_set.go +++ b/internal/waf/rule_set.go @@ -76,6 +76,18 @@ func (this *RuleSet) Init(waf *WAF) error { } } + // sort actions + sort.Slice(this.actionInstances, func(i, j int) bool { + var instance1 = this.actionInstances[i] + if !instance1.WillChange() { + return true + } + if instance1.Code() == ActionRecordIP { + return true + } + return false + }) + return nil } @@ -123,18 +135,6 @@ func (this *RuleSet) PerformActions(waf *WAF, group *RuleGroup, req requests.Req return true } - // 排序 - sort.Slice(this.actionInstances, func(i, j int) bool { - var instance1 = this.actionInstances[i] - if !instance1.WillChange() { - return true - } - if instance1.Code() == ActionRecordIP { - return true - } - return false - }) - // 先执行allow for _, instance := range this.actionInstances { if !instance.WillChange() {