|
|
|
@ -369,10 +369,6 @@ func NewClient(config *Config) (*Client, error) {
|
|
|
|
|
config.Transport = defConfig.Transport
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if config.HttpClient == nil {
|
|
|
|
|
config.HttpClient = defConfig.HttpClient
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if config.TLSConfig.Address == "" {
|
|
|
|
|
config.TLSConfig.Address = defConfig.TLSConfig.Address
|
|
|
|
|
}
|
|
|
|
@ -434,17 +430,20 @@ func NewClient(config *Config) (*Client, error) {
|
|
|
|
|
// NewHttpClient returns an http client configured with the given Transport and TLS
|
|
|
|
|
// config.
|
|
|
|
|
func NewHttpClient(transport *http.Transport, tlsConf TLSConfig) (*http.Client, error) {
|
|
|
|
|
tlsClientConfig, err := SetupTLSConfig(&tlsConf)
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
transport.TLSClientConfig = tlsClientConfig
|
|
|
|
|
client := &http.Client{
|
|
|
|
|
Transport: transport,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if transport.TLSClientConfig == nil {
|
|
|
|
|
tlsClientConfig, err := SetupTLSConfig(&tlsConf)
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
transport.TLSClientConfig = tlsClientConfig
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return client, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|