Created
January 11, 2021 06:42
-
-
Save hallazzang/cdaedb3325000d268d0da4db7cd1d7b4 to your computer and use it in GitHub Desktop.
Check if net error is a proxy connection error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"errors" | |
"net" | |
) | |
func IsProxyError(err error) bool { | |
var operr *net.OpError | |
if errors.As(err, &operr) { | |
if operr.Op == "proxyconnect" { | |
return true | |
} | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment