1
0
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:
源文雨
2024-07-13 02:19:33 +09:00
parent f25df3c0d7
commit 4a8e848673

View File

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