Skip to content

Instantly share code, notes, and snippets.

@hallazzang
Created January 11, 2021 06:42
Show Gist options
  • Save hallazzang/cdaedb3325000d268d0da4db7cd1d7b4 to your computer and use it in GitHub Desktop.
Save hallazzang/cdaedb3325000d268d0da4db7cd1d7b4 to your computer and use it in GitHub Desktop.
Check if net error is a proxy connection error
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