go: net/http: ProxyFromEnvironment does not support socks5
What version of Go are you using (go version
)?
go version go1.7.4 linux/amd64
What operating system and processor architecture are you using (go env
)?
actually it’s Manjaro
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bruce/go_ext_path"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build134643851=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
What did you do?
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
export http_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5://127.0.0.1:1080
go get -u -v github.com/zmb3/gogetdoc
What did you expect to see?
Git can use socks5 proxy to clone a repo, so i expect go get
can use socks5 proxy to download/update package github.com/zmb3/gogetdoc
What did you see instead?
github.com/zmb3/gogetdoc (download) Fetching https://golang.org/x/tools/go/buildutil?go-get=1 https fetch failed: Get https://golang.org/x/tools/go/buildutil?go-get=1: http: error connecting to proxy http://socks5😕/127.0.0.1:1080: dial tcp 59.50.43.82:0: i/o timeout package golang.org/x/tools/go/buildutil: unrecognized import path “golang.org/x/tools/go/buildutil” (https fetch: Get https://golang.org/x/tools/go/buildutil?go-get=1: http: error connecting to proxy http://socks5😕/127.0.0.1:1080: dial tcp 59.50.43.82:0: i/o timeout) Fetching https://golang.org/x/tools/go/loader?go-get=1 https fetch failed: Get https://golang.org/x/tools/go/loader?go-get=1: http: error connecting to proxy http://socks5😕/127.0.0.1:1080: dial tcp 59.50.43.82:0: i/o timeout package golang.org/x/tools/go/loader: unrecognized import path “golang.org/x/tools/go/loader” (https fetch: Get https://golang.org/x/tools/go/loader?go-get=1: http: error connecting to proxy http://socks5😕/127.0.0.1:1080: dial tcp 59.50.43.82:0: i/o timeout) [bruce@bruce-manjaro ~]$ set https_proxy=socks5://127.0.0.1:1080 [bruce@bruce-manjaro ~]$ go get -u -v github.com/zmb3/gogetdoc github.com/zmb3/gogetdoc (download) Fetching https://golang.org/x/tools/go/buildutil?go-get=1 https fetch failed: Get https://golang.org/x/tools/go/buildutil?go-get=1: http: error connecting to proxy http://socks5😕/127.0.0.1:1080: dial tcp 59.50.43.82:0: i/o timeout package golang.org/x/tools/go/buildutil: unrecognized import path “golang.org/x/tools/go/buildutil” (https fetch: Get https://golang.org/x/tools/go/buildutil?go-get=1: http: error connecting to proxy http://socks5😕/127.0.0.1:1080: dial tcp 59.50.43.82:0: i/o timeout) Fetching https://golang.org/x/tools/go/loader?go-get=1 https fetch failed: Get https://golang.org/x/tools/go/loader?go-get=1: http: error connecting to proxy http://socks5😕/127.0.0.1:1080: dial tcp 59.50.43.82:0: i/o timeout package golang.org/x/tools/go/loader: unrecognized import path “golang.org/x/tools/go/loader” (https fetch: Get https://golang.org/x/tools/go/loader?go-get=1: http: error connecting to proxy http://socks5😕/127.0.0.1:1080: dial tcp 59.50.43.82:0: i/o timeout)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (14 by maintainers)
Commits related to this issue
- net/http: add support for socks5 proxy See #18508 This commit adds http Client support for socks5 proxies. Change-Id: Ib015f3819801da13781d5acdd780149ae1f5857b Reviewed-on: https://go-review.google... — committed to golang/go by walken-google 7 years ago
- net/http: replace SOCKS client implementation This change replaces the vendored socks client implementation with the bundle of golang.org/x/net/internal/socks package which contains fixes for 19354 a... — committed to golang/go by cixtor 7 years ago
Maybe, implementaion will be like below.
tested with server written in go https://github.com/armon/go-socks5