Support for adding custom TLS Config for HTTP client

pull/5541/head
Cameron Sparr 2016-02-04 13:09:27 -07:00
parent 5a124e0e0b
commit df1980ebe5
1 changed files with 7 additions and 0 deletions

View File

@ -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,