From ce091ab42b91ea3a0fdb323e44b662f8ef618cb9 Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Mon, 12 Jun 2023 11:43:18 +0200 Subject: [PATCH] test windows --- .../internal/routemanager/systemops_windows.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/client/internal/routemanager/systemops_windows.go b/client/internal/routemanager/systemops_windows.go index 8be747222..5df48fdf4 100644 --- a/client/internal/routemanager/systemops_windows.go +++ b/client/internal/routemanager/systemops_windows.go @@ -4,7 +4,7 @@ package routemanager import ( - "fmt" + "net" "net/netip" "github.com/yusufpapurcu/wmi" @@ -25,15 +25,13 @@ func existsInRouteTable(prefix netip.Prefix) (bool, error) { return true, err } - fmt.Println("Destination Networks:") for _, route := range routes { - fmt.Println("Destination :", route.Destination) - fmt.Println("Mask :", route.Mask) - // mask, _ := toIPAddr(m.Addrs[2]) - // cidr, _ := net.IPMask(mask.To4()).Size() - // if route.Destination == prefix.Addr().String() && cidr == prefix.Bits() { - // return true, nil - // } + ip := net.ParseIP(route.Mask) + mask := net.IPMask(ip) + cidr, _ := mask.Size() + if route.Destination == prefix.Addr().String() && cidr == prefix.Bits() { + return true, nil + } } return false, nil }