code: func NewEtcdClient(machines []string, cert, key, caCert string, clientInsecure bool, basicAuth bool, username string, password string) (*Client, error) {
  	var c client.Client
  	var kapi client.KeysAPI
  	var err error
  	var transport = &http.Transport{
  		Proxy: http.ProxyFromEnvironment,
  		Dial: (&net.Dialer{
  			Timeout:   30 * time.Second,
  			KeepAlive: 30 * time.Second,
  		}).Dial,
  		TLSHandshakeTimeout: 10 * time.Second,
  	}
  
          // Enable client insecure mode globally
          if clientInsecure {
                  log.Warning("TLS Client config running insecure mode. Skip server CA verification.")
          }
  
  	tlsConfig := &tls.Config{
  		InsecureSkipVerify: clientInsecure,
  	}
  
  	cfg := client.Config{
  		Endpoints:               machines,
  		HeaderTimeoutPerRequest: time.Duration(3) * time.Second,
  	}
  
  	if basicAuth {
  		cfg.Username = username
  		cfg.Password = password
  	}
  
  	if caCert != "" {
  		certBytes, err := ioutil.ReadFile(caCert)
  		if err != nil {
  			return &Client{kapi}, err
  		}
  
  		caCertPool := x509.NewCertPool()
  		ok := caCertPool.AppendCertsFromPEM(certBytes)
  
  		if ok {
  			tlsConfig.RootCAs = caCertPool
  		}
  	}
  
  	if cert != "" && key != "" {
  		tlsCert, err := tls.LoadX509KeyPair(cert, key)
  		if err != nil {
  			return &Client{kapi}, err
  		}
  		tlsConfig.Certificates = []tls.Certificate{tlsCert}
  	}
  
  	transport.TLSClientConfig = tlsConfig
  	cfg.Transport = transport
  
  	c, err = client.New(cfg)
  	if err != nil {
  		return &Client{kapi}, err
  	}
  
  	kapi = client.NewKeysAPI(c)
  	return &Client{kapi}, nil
  }
docs: // NewEtcdClient returns an *etcd.Client with a connection to named machines.