add some logging
This commit is contained in:
parent
86f36fc0ca
commit
9b71884b9c
|
@ -4,6 +4,7 @@ import (
|
|||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
etcd "github.com/coreos/etcd/clientv3"
|
||||
|
@ -17,8 +18,11 @@ type EasyConfig struct {
|
|||
}
|
||||
|
||||
func (c EasyConfig) prepare() (etcd.Config, error) {
|
||||
log.Println("enter prepare() for EasyConfig")
|
||||
log.Printf("clientCert is '%s'", c.ClientCert)
|
||||
cert, err := tls.X509KeyPair([]byte(c.ClientCert), []byte(c.ClientKey))
|
||||
if err != nil {
|
||||
log.Println("error building keypair")
|
||||
return etcd.Config{}, err
|
||||
}
|
||||
|
||||
|
@ -40,12 +44,14 @@ func (c EasyConfig) prepare() (etcd.Config, error) {
|
|||
|
||||
conn, err := tls.Dial("tcp", c.Endpoints[0], tc)
|
||||
if err != nil {
|
||||
log.Printf("can't connect to %s:%s", c.Endpoints[0], err)
|
||||
return etcd.Config{}, err
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
err = conn.Handshake()
|
||||
if err != nil {
|
||||
log.Printf("failed tls handshake with %s:%s", c.Endpoints[0], err)
|
||||
return etcd.Config{}, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue