mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-27 14:20:27 +08:00
fix router
This commit is contained in:
@@ -49,15 +49,15 @@ func (m *Me) AddPeer(peerip string, pubicKey *[32]byte, endPoint string, allowed
|
||||
_, cidr, err := net.ParseCIDR(ipnet)
|
||||
if err == nil {
|
||||
l.allowedips = append(l.allowedips, cidr)
|
||||
l.me.router.SetItem(cidr, l)
|
||||
l.me.connmapmu.Lock()
|
||||
l.me.connections[peerip] = l
|
||||
l.me.connmapmu.Unlock()
|
||||
} else {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
l.me.router.SetItem(&net.IPNet{IP: l.peerip, Mask: net.IPMask(net.IPv4bcast)}, l)
|
||||
l.me.connmapmu.Lock()
|
||||
l.me.connections[peerip] = l
|
||||
l.me.connmapmu.Unlock()
|
||||
logrus.Infoln("[peer] add peer:", peerip, "allow:", allowedIPs)
|
||||
go l.keepAlive()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user