1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-09 02:02:41 +08:00

add some logs

This commit is contained in:
fumiama
2021-12-30 16:26:33 +08:00
parent 711133d4ec
commit cc6369abd3

View File

@@ -42,8 +42,8 @@ func (r *Router) SetDefault(l *Link) {
// NextHop 得到前往 ip 的下一跳的 link
func (r *Router) NextHop(ip string) *Link {
ipb := net.ParseIP(ip)
logrus.Infoln("[router] search for ip", ipb)
if ipb == nil {
logrus.Errorln("[router] nil ip")
return nil
}
@@ -56,11 +56,14 @@ func (r *Router) NextHop(ip string) *Link {
_, cdr, err := net.ParseCIDR(c)
if err == nil {
if cdr.Contains(ipb) {
logrus.Infoln("[router] get nexthop to", ipb, "-->", cdr)
return l
}
}
}
logrus.Errorln("[router] cannot find nexthop for ip:", ipb)
return nil
}