问题描述
我正在使用 google-cloud-cpp (适用于Google Cloud Platform的C ++ API函数)来创建/读取/写入存储桶.当我在组织的防火墙内工作时,我必须使用代理才能连接到Google Cloud.我看到我们可以使用gcloud命令行配置代理:gcloud config设置代理/类型httpgcloud配置设置代理/地址x.x.x.xgcloud config设置代理/端口
I am using google-cloud-cpp (C++ API for Google Cloud Platform functions) to create/read/write to buckets. When I am working from within the organization's firewall, I have to use a proxy to be able to connect to google cloud.I see that we can configure a proxy using the gcloud command line:gcloud config set proxy/type httpgcloud config set proxy/address x.x.x.xgcloud config set proxy/port
使用google-cloud-cpp时可以做类似的事情吗?
Can I do something similar when I use google-cloud-cpp?
推荐答案
如果我们查看GitHub上的google-cloud-cpp库的源代码,我们似乎会发现它基于libcurl.
If we look at the source code of the google-cloud-cpp library as found on GitHub, we seem to see that it is based on libcurl.
接下来,根据@Travis Webb的评论,我们查看libcurl的文档并找到:
Following on from the comments by @Travis Webb, we then look at the docs for libcurl and find:
https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html
此文档介绍了可用于为使用libcurl的程序设置代理设置的API.但是,如果我们读得更深入,则会发现有关环境变量的部分,该部分声明可以设置http_proxy
和https_proxy
.
This documents API that can be used to set proxy settings for programs that use libcurl. However, if we read deeper, we find a section on environment variables that declares that http_proxy
and https_proxy
can be set.
这篇关于有没有办法将http代理用于google-cloud-cpp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!