mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-04 23:40:26 +08:00
fix(link): noroute skip
This commit is contained in:
@@ -92,15 +92,17 @@ func (m *Me) AddPeer(cfg *PeerConfig) (l *Link) {
|
||||
}
|
||||
}
|
||||
_, 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[cfg.PeerIP] = l
|
||||
l.me.connmapmu.Unlock()
|
||||
} else {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
l.allowedips = append(l.allowedips, cidr)
|
||||
if noroute {
|
||||
continue
|
||||
}
|
||||
l.me.router.SetItem(cidr, l)
|
||||
l.me.connmapmu.Lock()
|
||||
l.me.connections[cfg.PeerIP] = l
|
||||
l.me.connmapmu.Unlock()
|
||||
}
|
||||
}
|
||||
logrus.Infoln("[peer] add peer:", cfg.PeerIP, "allow:", cfg.AllowedIPs)
|
||||
|
||||
Reference in New Issue
Block a user