Skip to content

Commit

Permalink
fix(engine): wrong syntax/behaviour at prepareCIDR
Browse files Browse the repository at this point in the history
  • Loading branch information
javierprovecho authored Feb 8, 2021
1 parent 39b372f commit e14a43c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ func (engine *Engine) Run(addr ...string) (err error) {

func (engine *Engine) prepareCIDR() ([]*net.IPNet, error) {
if engine.TrustedProxies != nil {
cidr := make([]*net.IPNet, len(engine.TrustedProxies), 0)
cidr := make([]*net.IPNet, 0, len(engine.TrustedProxies))
for _, trustedProxy := range engine.TrustedProxies {
if strings.Contains(trustedProxy, "/") {
if !strings.Contains(trustedProxy, "/") {
trustedProxy += "/32"
}
_, cidrNet, err := net.ParseCIDR(trustedProxy)
Expand Down

0 comments on commit e14a43c

Please sign in to comment.