// request is aborted with the provided error.
//
// The proxy type is determined by the URL scheme. "http",
- // "https", and "socks5" are supported. If the scheme is empty,
+ // "https", "socks5", and "socks5h" are supported. If the scheme is empty,
// "http" is assumed.
+ // "socks5" is treated the same as "socks5h".
//
// If the proxy URL contains a userinfo subcomponent,
// the proxy request will pass the username and password
//
// The environment values may be either a complete URL or a
// "host[:port]", in which case the "http" scheme is assumed.
-// The schemes "http", "https", and "socks5" are supported.
// An error is returned if the value is a different form.
//
// A nil URL and nil error are returned if no proxy is defined in the
switch {
case cm.proxyURL == nil:
// Do nothing. Not using a proxy.
- case cm.proxyURL.Scheme == "socks5":
+ case cm.proxyURL.Scheme == "socks5" || cm.proxyURL.Scheme == "socks5h":
conn := pconn.conn
d := socksNewDialer("tcp", conn.RemoteAddr().String())
if u := cm.proxyURL.User; u != nil {
}
var portMap = map[string]string{
- "http": "80",
- "https": "443",
- "socks5": "1080",
+ "http": "80",
+ "https": "443",
+ "socks5": "1080",
+ "socks5h": "1080",
}
func idnaASCIIFromURL(url *url.URL) string {
{env: "http://127.0.0.1:8080", want: "http://127.0.0.1:8080"},
{env: "https://127.0.0.1:8080", want: "https://127.0.0.1:8080"},
{env: "socks5://127.0.0.1", want: "socks5://127.0.0.1"},
+ {env: "socks5h://127.0.0.1", want: "socks5h://127.0.0.1"},
// Don't use secure for http
{req: "http://insecure.tld/", env: "http.proxy.tld", httpsenv: "secure.proxy.tld", want: "http://http.proxy.tld"},