go - 使用 Internet Explorer 代理设置

标签 go proxy

我正在开发一个需要连接到互联网的 go 应用程序。我使用 http.ProxyFromEnvironment 传输来自动检测 linux 上的代理,但它在 windows 上不够用。

如何检索 Internet Explorer 的代理设置?

最佳答案

这些值可以在注册表中找到:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

这是一个简单的库,可让您轻松检索这些设置(免责声明:我最近重新编写了该库的大部分内容):https://godoc.org/github.com/mattn/go-ieproxy

您可以通过在 init 函数中调用 OverrideEnvWithStaticProxy() 透明地使用 http.ProxyFromEnvironment:

func init() {
    ieproxy.OverrideEnvWithStaticProxy()
    http.DefaultTransport.(*http.Transport).Proxy = http.ProxyFromEnvironment
}

关于go - 使用 Internet Explorer 代理设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41764614/

相关文章:

go - 数据库连接最佳实践

java - 字节码操作能否在运行时更改 Java 方法的返回类型?

kubernetes - 如何使用 Kubernetes Go 客户端调用 Pod 代理动词?

java - 在哪里可以找到 httpd.conf 或 apache2.conf 文件或 ./configure 文件,以便我可以在 apache-tomcat-7.0.62 中进行代理设置?

java - 如何在 java 中使用 Http、Socks4 和 Socks5 代理?

json - 获取Go json unmarshal中出错的字段名

angularjs - 使用 Go 为 Rest API 返回 0

go - 创建 http 处理程序

arrays - 解析服务器发送的数组/slice

proxy - 如何配置 kube-proxy 绑定(bind) IP 地址?