fix create tls work connection (#2013)

This commit is contained in:
lonwern 2020-09-29 15:44:52 +08:00 committed by GitHub
parent ef5ae3e598
commit 0f8040b875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -211,10 +211,11 @@ func (ctl *Control) connectServer() (conn net.Conn, err error) {
var tlsConfig *tls.Config var tlsConfig *tls.Config
if ctl.clientCfg.TLSEnable { if ctl.clientCfg.TLSEnable {
tlsConfig, err = transport.NewServerTLSConfig( tlsConfig, err = transport.NewClientTLSConfig(
ctl.clientCfg.TLSCertFile, ctl.clientCfg.TLSCertFile,
ctl.clientCfg.TLSKeyFile, ctl.clientCfg.TLSKeyFile,
ctl.clientCfg.TLSTrustedCaFile) ctl.clientCfg.TLSTrustedCaFile,
ctl.clientCfg.ServerAddr)
if err != nil { if err != nil {
xl.Warn("fail to build tls configuration when connecting to server, err: %v", err) xl.Warn("fail to build tls configuration when connecting to server, err: %v", err)