mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-19 04:10:30 +08:00
修复DDoS防护规则无法生成的Bug
This commit is contained in:
@@ -33,7 +33,7 @@ func init() {
|
|||||||
|
|
||||||
nodeConfig, _ := nodeconfigs.SharedNodeConfig()
|
nodeConfig, _ := nodeconfigs.SharedNodeConfig()
|
||||||
if nodeConfig != nil {
|
if nodeConfig != nil {
|
||||||
err := SharedDDoSProtectionManager.Apply(nodeConfig.DDOSProtection)
|
err := SharedDDoSProtectionManager.Apply(nodeConfig.DDoSProtection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
remotelogs.Error("FIREWALL", "apply DDoS protection failed: "+err.Error())
|
remotelogs.Error("FIREWALL", "apply DDoS protection failed: "+err.Error())
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ func init() {
|
|||||||
events.On(events.EventNFTablesReady, func() {
|
events.On(events.EventNFTablesReady, func() {
|
||||||
nodeConfig, _ := nodeconfigs.SharedNodeConfig()
|
nodeConfig, _ := nodeconfigs.SharedNodeConfig()
|
||||||
if nodeConfig != nil {
|
if nodeConfig != nil {
|
||||||
err := SharedDDoSProtectionManager.Apply(nodeConfig.DDOSProtection)
|
err := SharedDDoSProtectionManager.Apply(nodeConfig.DDoSProtection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
remotelogs.Error("FIREWALL", "apply DDoS protection failed: "+err.Error())
|
remotelogs.Error("FIREWALL", "apply DDoS protection failed: "+err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ func (this *APIStream) handleCheckLocalFirewall(message *pb.NodeStreamMessage) e
|
|||||||
"version": version,
|
"version": version,
|
||||||
}
|
}
|
||||||
|
|
||||||
var protectionConfig = sharedNodeConfig.DDOSProtection
|
var protectionConfig = sharedNodeConfig.DDoSProtection
|
||||||
err = firewalls.SharedDDoSProtectionManager.Apply(protectionConfig)
|
err = firewalls.SharedDDoSProtectionManager.Apply(protectionConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.replyFail(message.RequestId, dataMessage.Name+"was installed, but apply DDoS protection config failed: "+err.Error())
|
this.replyFail(message.RequestId, dataMessage.Name+"was installed, but apply DDoS protection config failed: "+err.Error())
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ func (this *Node) loop() error {
|
|||||||
}
|
}
|
||||||
if len(resp.DdosProtectionJSON) == 0 {
|
if len(resp.DdosProtectionJSON) == 0 {
|
||||||
if sharedNodeConfig != nil {
|
if sharedNodeConfig != nil {
|
||||||
sharedNodeConfig.DDOSProtection = nil
|
sharedNodeConfig.DDoSProtection = nil
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var ddosProtectionConfig = &ddosconfigs.ProtectionConfig{}
|
var ddosProtectionConfig = &ddosconfigs.ProtectionConfig{}
|
||||||
@@ -395,6 +395,10 @@ func (this *Node) loop() error {
|
|||||||
return errors.New("decode DDoS protection config failed: " + err.Error())
|
return errors.New("decode DDoS protection config failed: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if sharedNodeConfig != nil {
|
||||||
|
sharedNodeConfig.DDoSProtection = ddosProtectionConfig
|
||||||
|
}
|
||||||
|
|
||||||
err = firewalls.SharedDDoSProtectionManager.Apply(ddosProtectionConfig)
|
err = firewalls.SharedDDoSProtectionManager.Apply(ddosProtectionConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// 不阻塞
|
// 不阻塞
|
||||||
|
|||||||
Reference in New Issue
Block a user