dongxiaoxing3058
dongxiaoxing3058
2018-09-10 19:51
浏览 50
已采纳

Google Golang SDK使用自定义CA捆绑包

I am trying to pull messages from a Google Cloud Pub/Sub Subscription using the Google Cloud Client Library for Go (https://godoc.org/cloud.google.com/go/pubsub).

I am going through an HTTP proxy that uses TLS interception, so I need the pubsub client (it appears to be using gRPC) to use a custom CA cert bundle for its request verification. How can I make this work? Also, is there a way to configure proxy support other than setting http_proxy and https_proxy?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试使用Go的Google Cloud Client库从Google Cloud Pub / Sub Subscription提取消息(< a href =“ https://godoc.org/cloud.google.com/go/pubsub” rel =“ nofollow noreferrer”> https://godoc.org/cloud.google.com/go/pubsub )。

我正在通过使用TLS拦截的HTTP代理,因此我需要pubsub客户端(它似乎正在使用gRPC)来使用自定义CA证书捆绑包进行请求验证。 我该如何进行这项工作? 另外,除了设置http_proxy和https_proxy之外,还有其他方法可以配置代理支持吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dousi6192
    dousi6192 2018-09-13 04:01
    已采纳

    For anyone else interested in the answer to this problem, you can set an environmental variable:

    export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=/path/to/my/cert/bundle.pem
    

    Also, you can display more debug information by setting this environmental variable:

    export GRPC_VERBOSITY=DEBUG
    

    For the list of all env vars you can set see here: https://github.com/grpc/grpc/blob/master/doc/environment_variables.md

    点赞 评论

相关推荐