From 2a554188db689e1260804dd82fa8be2f52b36db2 Mon Sep 17 00:00:00 2001 From: Will Scott Date: Thu, 15 Jul 2021 16:21:31 -0700 Subject: [PATCH] skip loopback addr as indication of v6 routes --- netroute_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netroute_test.go b/netroute_test.go index 66bf293..3899c89 100644 --- a/netroute_test.go +++ b/netroute_test.go @@ -1,6 +1,7 @@ package netroute import ( + "fmt" "net" "strings" "testing" @@ -32,7 +33,8 @@ func TestRoute(t *testing.T) { for _, addr := range addrs { if strings.HasPrefix(addr.Network(), "ip") { _, ipn, _ := net.ParseCIDR(addr.String()) - if ipn.IP.To4() == nil && !ipn.IP.IsInterfaceLocalMulticast() && !ipn.IP.IsLinkLocalUnicast() && !ipn.IP.IsLinkLocalMulticast() { + if ipn.IP.To4() == nil && !ipn.IP.IsInterfaceLocalMulticast() && !ipn.IP.IsLinkLocalUnicast() && !ipn.IP.IsLinkLocalMulticast() && !ipn.IP.IsLoopback() { + fmt.Printf("%s: %s is v6\n", addr.String(), ipn) hasV6 = true break }