MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / init

Function init

internal/firewalls/ddos_protection.go:31–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29var SharedDDoSProtectionManager = NewDDoSProtectionManager()
30
31func init() {
32 if !teaconst.IsMain {
33 return
34 }
35
36 events.On(events.EventReload, func() {
37 if nftablesInstance == nil {
38 return
39 }
40
41 nodeConfig, _ := nodeconfigs.SharedNodeConfig()
42 if nodeConfig != nil {
43 err := SharedDDoSProtectionManager.Apply(nodeConfig.DDoSProtection)
44 if err != nil {
45 remotelogs.Error("FIREWALL", "apply DDoS protection failed: "+err.Error())
46 }
47 }
48 })
49
50 events.On(events.EventNFTablesReady, func() {
51 nodeConfig, _ := nodeconfigs.SharedNodeConfig()
52 if nodeConfig != nil {
53 err := SharedDDoSProtectionManager.Apply(nodeConfig.DDoSProtection)
54 if err != nil {
55 remotelogs.Error("FIREWALL", "apply DDoS protection failed: "+err.Error())
56 }
57 }
58 })
59}
60
61// DDoSProtectionManager DDoS防护
62type DDoSProtectionManager struct {

Callers

nothing calls this directly

Calls 4

OnFunction · 0.92
ErrorFunction · 0.92
ApplyMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected