Skip to content

Commit

Permalink
skip loopback addr as indication of v6 routes
Browse files Browse the repository at this point in the history
  • Loading branch information
willscott committed Jul 15, 2021
1 parent 68596b5 commit 2a55418
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion netroute_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package netroute

import (
"fmt"
"net"
"strings"
"testing"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 2a55418

Please sign in to comment.