initialize trustedCIDRs directly

directly initialization
This commit is contained in:
Notealot 2021-09-22 16:23:32 +08:00
parent c2e6c7ed9d
commit c7e3b728fb

4
gin.go
View File

@ -183,12 +183,16 @@ func New() *Engine {
trees: make(methodTrees, 0, 9), trees: make(methodTrees, 0, 9),
delims: render.Delims{Left: "{{", Right: "}}"}, delims: render.Delims{Left: "{{", Right: "}}"},
secureJSONPrefix: "while(1);", secureJSONPrefix: "while(1);",
trustedCIDRs: []*net.IPNet{{IP: net.IP{0x0, 0x0, 0x0, 0x0}, Mask: net.IPMask{0x0, 0x0, 0x0, 0x0}}},
} }
engine.RouterGroup.engine = engine engine.RouterGroup.engine = engine
engine.pool.New = func() interface{} { engine.pool.New = func() interface{} {
return engine.allocateContext() return engine.allocateContext()
} }
<<<<<<< Updated upstream
_ = engine.parseTrustedProxies() _ = engine.parseTrustedProxies()
=======
>>>>>>> Stashed changes
return engine return engine
} }