mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-06 07:45:47 +08:00
WAF策略中增加验证码相关定制设置
This commit is contained in:
@@ -26,12 +26,14 @@ type WAF struct {
|
||||
UseLocalFirewall bool `yaml:"useLocalFirewall" json:"useLocalFirewall"`
|
||||
SYNFlood *firewallconfigs.SYNFloodConfig `yaml:"synFlood" json:"synFlood"`
|
||||
|
||||
DefaultBlockAction *BlockAction
|
||||
DefaultBlockAction *BlockAction
|
||||
DefaultCaptchaAction *CaptchaAction
|
||||
|
||||
hasInboundRules bool
|
||||
hasOutboundRules bool
|
||||
|
||||
checkpointsMap map[string]checkpoints.CheckpointInterface // prefix => checkpoint
|
||||
actionMap map[int64]ActionInterface // actionId => ActionInterface
|
||||
}
|
||||
|
||||
func NewWAF() *WAF {
|
||||
@@ -74,6 +76,9 @@ func (this *WAF) Init() (resultErrors []error) {
|
||||
this.checkpointsMap[def.Prefix] = instance
|
||||
}
|
||||
|
||||
// action map
|
||||
this.actionMap = map[int64]ActionInterface{}
|
||||
|
||||
// rules
|
||||
this.hasInboundRules = len(this.Inbound) > 0
|
||||
this.hasOutboundRules = len(this.Outbound) > 0
|
||||
@@ -324,8 +329,16 @@ func (this *WAF) ContainsGroupCode(code string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (this *WAF) AddAction(action ActionInterface) {
|
||||
this.actionMap[action.ActionId()] = action
|
||||
}
|
||||
|
||||
func (this *WAF) FindAction(actionId int64) ActionInterface {
|
||||
return this.actionMap[actionId]
|
||||
}
|
||||
|
||||
func (this *WAF) Copy() *WAF {
|
||||
waf := &WAF{
|
||||
var waf = &WAF{
|
||||
Id: this.Id,
|
||||
IsOn: this.IsOn,
|
||||
Name: this.Name,
|
||||
|
||||
Reference in New Issue
Block a user