remove nil statement

This commit is contained in:
thinkerou 2021-03-27 20:37:01 +08:00
parent 2d7fc06969
commit 3483d2c07d

View File

@ -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
}
} }
} }
} }