Skip to content

Commit

Permalink
errkit: detect permanent network errors when behind http/socks proxy
Browse files Browse the repository at this point in the history
If HTTP(S)/SOCKS proxies are used the errors returned by http.Client are different.
  • Loading branch information
mionskowski-form3 committed Jul 9, 2024
1 parent fcdd849 commit 614c660
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions errkit/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ func isNetworkPermanentErr(err *ErrorX) bool {
return true
case strings.Contains(v, "connect: connection refused"):
return true
case strings.Contains(v, "Unable to connect"):
// occurs when HTTP(S) proxy is used
return true
case strings.Contains(v, "host unreachable"):
// occurs when SOCKS proxy is used
return true
}
return false
}
Expand Down

0 comments on commit 614c660

Please sign in to comment.