[client] improve adding route log message (#4034)

from:
  Adding route to 1.2.3.4/32 via invalid IP @ 10 (wt0)
to:
  Adding route to 1.2.3.4/32 via no-ip @ 10 (wt0)
This commit is contained in:
Krzysztof Nazarewski (kdn)
2025-06-30 11:57:42 +02:00
committed by GitHub
parent 0480507a10
commit c1c71b6d39

View File

@@ -28,8 +28,11 @@ func (n Nexthop) String() string {
if n.Intf == nil { if n.Intf == nil {
return n.IP.String() return n.IP.String()
} }
if n.IP.IsValid() {
return fmt.Sprintf("%s @ %d (%s)", n.IP.String(), n.Intf.Index, n.Intf.Name) return fmt.Sprintf("%s @ %d (%s)", n.IP.String(), n.Intf.Index, n.Intf.Name)
} }
return fmt.Sprintf("no-ip @ %d (%s)", n.Intf.Index, n.Intf.Name)
}
type wgIface interface { type wgIface interface {
Address() wgaddr.Address Address() wgaddr.Address