mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-17 22:32:26 +08:00
remove nil statement
This commit is contained in:
parent
2d7fc06969
commit
3483d2c07d
14
context.go
14
context.go
@ -767,14 +767,12 @@ func (c *Context) RemoteIP() (net.IP, bool) {
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
trustedCIDRs, err := c.engine.prepareTrustedCIDRs()
|
trustedCIDRs, _ := c.engine.prepareTrustedCIDRs()
|
||||||
if err == nil {
|
c.engine.trustedCIDRs = trustedCIDRs
|
||||||
c.engine.trustedCIDRs = trustedCIDRs
|
if c.engine.trustedCIDRs != nil {
|
||||||
if c.engine.trustedCIDRs != nil {
|
for _, cidr := range c.engine.trustedCIDRs {
|
||||||
for _, cidr := range c.engine.trustedCIDRs {
|
if cidr.Contains(remoteIP) {
|
||||||
if cidr.Contains(remoteIP) {
|
return remoteIP, true
|
||||||
return remoteIP, true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user