diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-09-16 18:40:22 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-09-16 18:40:22 +0200 |
commit | 7c8abdec738a267431468cefb807dcfcaf6202b0 (patch) | |
tree | 651a8357328e03aab9420a266e854a31667bf31e /tunnel | |
parent | version: bump (diff) | |
download | wireguard-windows-7c8abdec738a267431468cefb807dcfcaf6202b0.tar.xz wireguard-windows-7c8abdec738a267431468cefb807dcfcaf6202b0.zip |
tunnel: pretty print route failures better
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tunnel')
-rw-r--r-- | tunnel/addressconfig.go | 4 | ||||
-rw-r--r-- | tunnel/winipcfg/types.go | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/tunnel/addressconfig.go b/tunnel/addressconfig.go index f0537fc7..350dd645 100644 --- a/tunnel/addressconfig.go +++ b/tunnel/addressconfig.go @@ -129,7 +129,7 @@ func configureInterface(family winipcfg.AddressFamily, conf *conf.Config, luid w if !conf.Interface.TableOff { err := luid.SetRoutesForFamily(family, deduplicatedRoutes) if err != nil { - return fmt.Errorf("unable to set routes %v: %w", deduplicatedRoutes, err) + return fmt.Errorf("unable to set routes %+v: %w", deduplicatedRoutes, err) } } @@ -139,7 +139,7 @@ func configureInterface(family winipcfg.AddressFamily, conf *conf.Config, luid w err = luid.SetIPAddressesForFamily(family, addresses) } if err != nil { - return fmt.Errorf("unable to set ips %v: %w", addresses, err) + return fmt.Errorf("unable to set ips %+v: %w", addresses, err) } ipif, err := luid.IPInterface(family) diff --git a/tunnel/winipcfg/types.go b/tunnel/winipcfg/types.go index 870d058f..15aaa863 100644 --- a/tunnel/winipcfg/types.go +++ b/tunnel/winipcfg/types.go @@ -7,6 +7,7 @@ package winipcfg import ( "encoding/binary" + "fmt" "net" "unsafe" @@ -588,6 +589,10 @@ type RouteData struct { Metric uint32 } +func (routeData *RouteData) String() string { + return fmt.Sprintf("%+v", *routeData) +} + // IPAdapterDNSSuffix structure stores a DNS suffix in a linked list of DNS suffixes for a particular adapter. // https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_dns_suffix type IPAdapterDNSSuffix struct { |