From df1980ebe5a15019c37aec8be77357060c149064 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 4 Feb 2016 13:09:27 -0700 Subject: [PATCH] Support for adding custom TLS Config for HTTP client --- client/v2/client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/v2/client.go b/client/v2/client.go index 7f4406088d..f3de4bb1d5 100644 --- a/client/v2/client.go +++ b/client/v2/client.go @@ -41,6 +41,10 @@ type HTTPConfig struct { // InsecureSkipVerify gets passed to the http client, if true, it will // skip https certificate verification. Defaults to false InsecureSkipVerify bool + + // TLSConfig allows the user to set their own TLS config for the HTTP + // Client. If set, this option overrides InsecureSkipVerify. + TLSConfig *tls.Config } type UDPConfig struct { @@ -100,6 +104,9 @@ func NewHTTPClient(conf HTTPConfig) (Client, error) { InsecureSkipVerify: conf.InsecureSkipVerify, }, } + if conf.TLSConfig != nil { + tr.TLSClientConfig = conf.TLSConfig + } return &client{ url: u, username: conf.Username,