Skip to content

Commit

Permalink
fix(ipv6): detect ipv6 non-support with additional error message
Browse files Browse the repository at this point in the history
- `connect: network is unreachable`
  • Loading branch information
qdm12 committed Feb 2, 2024
1 parent a8ac5b0 commit 56a3c24
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/support/ipv6.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ func IPv6(ctx context.Context, ipv6AddrPort netip.AddrPort) (
if ctxErr := ctx.Err(); ctxErr != nil {
return false, ctxErr
}
if strings.HasSuffix(err.Error(), "cannot assign requested address") {
return false, nil
errMessage := err.Error()
ipv6ErrorMessages := []string{
"connect: network is unreachable",
"cannot assign requested address",
}
for _, ipv6ErrorMessage := range ipv6ErrorMessages {
if strings.Contains(errMessage, ipv6ErrorMessage) {
return false, nil
}
}
return false, fmt.Errorf("unknown error: %w", err)
}
Expand Down

0 comments on commit 56a3c24

Please sign in to comment.