Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: let go commands work well with some proxy tool, such as proxychains #31772

Closed
dotaheor opened this issue May 1, 2019 · 5 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@dotaheor
Copy link

dotaheor commented May 1, 2019

What version of Go are you using (go version)?

go version go1.12.2

What did you expect to see?

Many another commands, such as curl and gcloud, work well with proxychains.
I don't know why go commands don't.
I think if gcloud can, then go commands also can.

This is not a problem can be solved by GOPROXY and http(s)_proxy env vars.
proxychains is much more convenient and has better controls.

@bradfitz
Copy link
Contributor

bradfitz commented May 1, 2019

proxychains does LD_PRELOAD tricks to hook libc functions. Go doesn't use libc, so this is unfeasible.

Please file a separate bug if cmd/go isn't respecting HTTP_PROXY somewhere. But I don't know where. Note that Go's implementation of HTTP_PROXY also supports SOCKS, so you should be able to proxy to HTTP, HTTPS, or SOCKS.

I think if gcloud can, then go commands also can.

gcloud is written in Python, which uses libc, so proxychains happens to work. This wasn't a decision on gcloud's part.

This is not a problem can be solved by GOPROXY and http(s)_proxy env vars.

Why?

proxychains is much more convenient and has better controls.

Which controls?

But yes, for proxychains users it'd be more convenient if it worked, but unfortunately it can't for Go programs.

@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 1, 2019
@dotaheor
Copy link
Author

dotaheor commented May 2, 2019

@bradfitz
Thanks for your detailed reply.

Which controls?
Why?

With proxychains, it is convenient to switch between proxy-on and proxy-off mode, though it is only a little more convenient.

And proxychains supports remote dns resolving.

I just run some go get -u commands to confirm the behaviors of go commands. It looks go commands respect http_proxy and https_proxy, but not all_proxy, which curl respects. In my opinion, all_proxy is a little more convenient than http_proxyandhttps_proxy`.

I have not got a full understanding on GOPROXY yet. When its value is set as the value of https_proxy, go get -u doesn't work.

@dotaheor
Copy link
Author

dotaheor commented May 2, 2019

More info: my proxy is a socks5 proxy.

@bradfitz
Copy link
Contributor

bradfitz commented May 2, 2019

And proxychains supports remote dns resolving.

So does Go's SOCKS5 implementation.

I have not got a full understanding on GOPROXY yet.

GOPROXY is the proxy cache to get modules from. For instance, use https://proxy.golang.org/

But you can use it with HTTPS_PROXY to set your SOCK5 proxy for that.

Anyway, there's nothing to do here it seems so I'm going to close this bug.

@bradfitz bradfitz closed this as completed May 2, 2019
@dotaheor
Copy link
Author

dotaheor commented May 2, 2019

Would it be better to fallthrough to all_proxy if http[s]_proxy is not set?

@golang golang locked and limited conversation to collaborators May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants