mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-25 14:36:34 +08:00
优化WAF动作排序
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user