1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-05 07:50:24 +08:00

fix route

This commit is contained in:
fumiama
2021-12-30 17:27:59 +08:00
parent f2d80f5f4d
commit 6c50fa477d

View File

@@ -52,13 +52,10 @@ func (r *Router) NextHop(ip string) *Link {
r.mu.RLock()
defer r.mu.RUnlock()
for c, l := range r.table {
_, cdr, err := net.ParseCIDR(c)
if err == nil {
if cdr.Contains(ipb) {
logrus.Infoln("[router] get nexthop to", ipb, "-->", cdr)
return l
}
for _, c := range r.list {
if c.Contains(ipb) {
logrus.Infoln("[router] get nexthop to", ipb, "-->", c)
return r.table[c.String()]
}
}