From 0f8040b875db49b281285b0419dc685e7751a89a Mon Sep 17 00:00:00 2001 From: lonwern Date: Tue, 29 Sep 2020 15:44:52 +0800 Subject: [PATCH] fix create tls work connection (#2013) --- client/control.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/control.go b/client/control.go index c8ad7ed..c44a641 100644 --- a/client/control.go +++ b/client/control.go @@ -211,10 +211,11 @@ func (ctl *Control) connectServer() (conn net.Conn, err error) { var tlsConfig *tls.Config if ctl.clientCfg.TLSEnable { - tlsConfig, err = transport.NewServerTLSConfig( + tlsConfig, err = transport.NewClientTLSConfig( ctl.clientCfg.TLSCertFile, ctl.clientCfg.TLSKeyFile, - ctl.clientCfg.TLSTrustedCaFile) + ctl.clientCfg.TLSTrustedCaFile, + ctl.clientCfg.ServerAddr) if err != nil { xl.Warn("fail to build tls configuration when connecting to server, err: %v", err)