code: func newHTTPClient(cfg *config) (*http.Client, error) {
  	// Configure proxy if needed.
  	var dial func(network, addr string) (net.Conn, error)
  	if cfg.Proxy != "" {
  		proxy := &socks.Proxy{
  			Addr:     cfg.Proxy,
  			Username: cfg.ProxyUser,
  			Password: cfg.ProxyPass,
  		}
  		dial = func(network, addr string) (net.Conn, error) {
  			c, err := proxy.Dial(network, addr)
  			if err != nil {
  				return nil, err
  			}
  			return c, nil
  		}
  	}
  
  	// Configure TLS if needed.
  	var tlsConfig *tls.Config
  	if !cfg.NoTLS && cfg.RPCCert != "" {
  		pem, err := ioutil.ReadFile(cfg.RPCCert)
  		if err != nil {
  			return nil, err
  		}
  
  		pool := x509.NewCertPool()
  		pool.AppendCertsFromPEM(pem)
  		tlsConfig = &tls.Config{
  			RootCAs:            pool,
  			InsecureSkipVerify: cfg.TLSSkipVerify,
  		}
  	}
  
  	// Create and return the new HTTP client potentially configured with a
  	// proxy and TLS.
  	client := http.Client{
  		Transport: &http.Transport{
  			Dial:            dial,
  			TLSClientConfig: tlsConfig,
  		},
  	}
  	return &client, nil
  }
docs: // newHTTPClient returns a new HTTP client that is configured according to the
  // proxy and TLS settings in the associated connection configuration.