mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-28 14:50:26 +08:00
add some logs
This commit is contained in:
@@ -42,8 +42,8 @@ func (r *Router) SetDefault(l *Link) {
|
|||||||
// NextHop 得到前往 ip 的下一跳的 link
|
// NextHop 得到前往 ip 的下一跳的 link
|
||||||
func (r *Router) NextHop(ip string) *Link {
|
func (r *Router) NextHop(ip string) *Link {
|
||||||
ipb := net.ParseIP(ip)
|
ipb := net.ParseIP(ip)
|
||||||
logrus.Infoln("[router] search for ip", ipb)
|
|
||||||
if ipb == nil {
|
if ipb == nil {
|
||||||
|
logrus.Errorln("[router] nil ip")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,11 +56,14 @@ func (r *Router) NextHop(ip string) *Link {
|
|||||||
_, cdr, err := net.ParseCIDR(c)
|
_, cdr, err := net.ParseCIDR(c)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if cdr.Contains(ipb) {
|
if cdr.Contains(ipb) {
|
||||||
|
logrus.Infoln("[router] get nexthop to", ipb, "-->", cdr)
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logrus.Errorln("[router] cannot find nexthop for ip:", ipb)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user