简体   繁体   English

如何在Amazon Go库中使用https代理?

[英]how can I use a https proxy with Amazon go library?

I'm trying to use Hashicorp Packer to create and upload an AWS VM. 我正在尝试使用Hashicorp Packer创建和上传AWS VM。 I'm behind a http and https proxy, so when I set http_proxy and https_proxy (and HTTP_PROXY and HTTPS_PROXY) I can use the aws cli to see my S3 containers with no problems; 我位于http和https代理后面,因此当我设置http_proxy和https_proxy(以及HTTP_PROXY和HTTPS_PROXY)时,可以使用aws cli来查看我的S3容器,而不会出现任何问题。 however Hashicorp Packer uses the AWS go libraries, and according to https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#configuring-a-proxy and https://golang.org/pkg/net/http/#Transport they +only+ support HTTP_PROXY and not HTTPS_PROXY. 但是Hashicorp Packer使用AWS Go库,并根据https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#configuring-a-proxyhttps: //golang.org/pkg/net/http/#传输它们+仅+支持HTTP_PROXY而不支持HTTPS_PROXY。

Is there any way I can use the AWS Go library (or packages built using it, like Packer) with a HTTPS proxy? 有什么方法可以将AWS Go库(或使用它构建的程序包,如Packer)与HTTPS代理一起使用?

It should work just fine with HTTPS_PROXY. 使用HTTPS_PROXY应该可以正常工作。 The default transport (see https://golang.org/src/net/http/transport.go#L40 ) uses a ProxyFromEnvironment function (see https://golang.org/src/net/http/transport.go#L259 ) which you can see supports both HTTP_PROXY and HTTPS_PROXY 默认传输(请参阅https://golang.org/src/net/http/transport.go#L40 )使用ProxyFromEnvironment函数(请参阅https://golang.org/src/net/http/transport.go#L259 ),您可以看到它同时支持HTTP_PROXYHTTPS_PROXY

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM