通过socks5h代理获取

huangapple go评论96阅读模式
英文:

Go get via a socks5h proxy

问题

我有一个隔离的DNS测试环境,所有需要互联网的工具都通过一个SOCKS5代理进行访问并使用它来解析DNS(SOCKS5h)。gitaptcurl没有问题,但go有问题。即使设置了http_proxy=socks5h://user1:pass1@192.168.0.1:8100 go mod tidygo也不会使用代理来解析DNS,所以我会得到一个查找错误。

那么有没有办法解决这个问题呢?我愿意添加另一种代理类型,我只是真的需要保持第三层的隔离。

英文:

I have an isolated DNS testbed where all tools that need the internet go through a SOCKS5 proxy and use it to resolve DNS (SOCKS5h). git, apt and curl don't have an issues; go does. Even when setting http_proxy=socks5h://user1:pass1@192.168.0.1:8100 go mod tidy go does not use the proxy to resolve DNS so I get a lookup error.

So is there any way to solve this? I am willing to add another proxy type, I just really need to keep Layer 3 isolated.

答案1

得分: 3

根据问题#24135#13454,Go标准库中的net/http包目前不支持socks5h://,只支持socks5://

英文:

According to issue #24135 and #13454, net/http package in the Go standard library does not currently support socks5h://. Only socks5:// is currently supported.

huangapple
  • 本文由 发表于 2021年5月21日 04:00:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/67627189.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定