From d0cf145f857fb152cca4dc2968628540a9edee15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 6 Oct 2021 09:39:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96WAF=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/waf/rule_set.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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() {