Skip to content

Commit

Permalink
fix: allow ipv4-mapped ipv6 addresses
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Kreitzer <[email protected]>
  • Loading branch information
buroa committed Dec 11, 2024
1 parent fe2924b commit 19a5238
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"math"
"net"
"net/netip"
"reflect"
"strconv"
"strings"
Expand Down Expand Up @@ -390,6 +391,6 @@ func waitForDynamicCacheSync(ctx context.Context, factory dynamicInformerFactory

// isIPv6String returns if ip is IPv6.
func isIPv6String(ip string) bool {
netIP := net.ParseIP(ip)
return netIP != nil && netIP.To4() == nil
netIP, err := netip.ParseAddr(ip)
return err == nil && netIP.Is6()
}

0 comments on commit 19a5238

Please sign in to comment.