func buildHTTPTransport(opts *config) (*http.Transport, error) {
	// step: create the vault sidekick
	transport := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		Dial: (&net.Dialer{
			Timeout:   10 * time.Second,
			KeepAlive: 10 * time.Second,
		}).Dial,
		TLSHandshakeTimeout: 10 * time.Second,
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: opts.skipTLSVerify,
		},
	}
	if opts.skipTLSVerify {
		glog.Warning("skipping TLS verification is not recommended")
	}
	// step: are we loading a CA file
	if opts.vaultCaFile != "" {
		glog.V(3).Infof("loading the ca certificate: %s", opts.vaultCaFile)
		caCert, err := ioutil.ReadFile(opts.vaultCaFile)
		if err != nil {
			return nil, fmt.Errorf("unable to read in the ca: %s, reason: %s", opts.vaultCaFile, err)
		}
		caCertPool := x509.NewCertPool()
		caCertPool.AppendCertsFromPEM(caCert)
		transport.TLSClientConfig.RootCAs = caCertPool
	}

	return transport, nil
}
// buildHTTPTransport constructs a http transport for the http client
buildHTTPTransport constructs a http transport for the http client
// buildHTTPTransport constructs a http transport for the http client
func buildHTTPTransport(opts *config) (*http.Transport, error) {
	transport := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		Dial: (&net.Dialer{
			Timeout:   10 * time.Second,
			KeepAlive: 10 * time.Second,
		}).Dial,
		TLSHandshakeTimeout: 10 * time.Second,
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: opts.skipTLSVerify,
		},
	}
	if opts.skipTLSVerify {
		glog.Warning("skipping TLS verification is not recommended")
	}
	if opts.vaultCaFile != "" {
		glog.V(3).Infof("loading the ca certificate: %s", opts.vaultCaFile)
		caCert, err := ioutil.ReadFile(opts.vaultCaFile)
		if err != nil {
			return nil, fmt.Errorf("unable to read in the ca: %s, reason: %s", opts.vaultCaFile, err)
		}
		caCertPool := x509.NewCertPool()
		caCertPool.AppendCertsFromPEM(caCert)
		transport.TLSClientConfig.RootCAs = caCertPool
	}
	return transport, nil
}
func buildHTTPTransport ( opts * config ) ( * http . Transport , error ) { transport := & http . Transport { Proxy : http . ProxyFromEnvironment , Dial : ( & net . Dialer { Timeout : 10 * time . Second , KeepAlive : 10 * time . Second , } ) . Dial , TLSHandshakeTimeout : 10 * time . Second , TLSClientConfig : & tls . Config { InsecureSkipVerify : opts . skipTLSVerify , } , } if opts . skipTLSVerify { glog . Warning ( " " ) } if opts . vaultCaFile != " " { glog . V ( 3 ) . Infof ( " " , opts . vaultCaFile ) caCert , err := ioutil . ReadFile ( opts . vaultCaFile ) if err != nil { return nil , fmt . Errorf ( " " , opts . vaultCaFile , err ) } caCertPool := x509 . NewCertPool ( ) caCertPool . AppendCertsFromPEM ( caCert ) transport . TLSClientConfig . RootCAs = caCertPool } return transport , nil }
buildHTTPTransport constructs a http transport for the http client
buildHTTPTransport constructs a http transport for the http client
// step: create the vault sidekick // step: are we loading a CA file