diff --git a/netroute_linux.go b/netroute_linux.go index 02730e9..34ff107 100644 --- a/netroute_linux.go +++ b/netroute_linux.go @@ -3,6 +3,8 @@ package netroute import ( + "net" + "github.com/google/gopacket/routing" ) diff --git a/netroute_windows.go b/netroute_windows.go index f3dd4e1..2ce0ef1 100644 --- a/netroute_windows.go +++ b/netroute_windows.go @@ -222,7 +222,7 @@ func (r *winRouter) RouteWithSrc(input net.HardwareAddr, src, dst net.IP) (iface } iface = getIface(route.index) - if route.nextHop.Addr.Family == 0 /* AF_UNDEF */ { + if route nextHop == nil || route.nextHop.Addr.Family == 0 /* AF_UNDEF */ { return iface, nil, pref, nil } addr, err := route.nextHop.Sockaddr()