fix: data race with trustedCIDRs (#2674) (#2675)

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Xudong Cai
2021-04-09 00:27:34 +08:00
committed by GitHub
parent d496f64540
commit 03e5e05ae0
3 changed files with 17 additions and 3 deletions

View File

@ -767,8 +767,6 @@ func (c *Context) RemoteIP() (net.IP, bool) {
return nil, false
}
trustedCIDRs, _ := c.engine.prepareTrustedCIDRs()
c.engine.trustedCIDRs = trustedCIDRs
if c.engine.trustedCIDRs != nil {
for _, cidr := range c.engine.trustedCIDRs {
if cidr.Contains(remoteIP) {