Skip to content

Commit

Permalink
fix name resolution failure with -4 flag in static builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pouriyajamshidi committed Jan 21, 2025
1 parent 226e526 commit f358d34
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tcping.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@ func selectResolvedIP(tcping *tcping, ipAddrs []netip.Addr) netip.Addr {
if ip.Is4() {
ipList = append(ipList, ip)
}
// static builds (CGO=0) return IPv4-mapped IPv6 address
if ip.Is4In6() {
ipList = append(ipList, ip.Unmap())
}
}

if len(ipList) == 0 {
Expand Down

0 comments on commit f358d34

Please sign in to comment.