From 38a986634c4b3b098a7d99da350460bcc4291bec Mon Sep 17 00:00:00 2001 From: ctlove0523 <478309639@qq.com> Date: Tue, 12 Jan 2021 22:23:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E6=A0=B9?= =?UTF-8?q?=E8=AF=81=E4=B9=A6=E6=A0=A1=E9=AA=8C=E6=9C=8D=E5=8A=A1=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iot_device.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/iot_device.go b/iot_device.go index 012494e..79c1262 100644 --- a/iot_device.go +++ b/iot_device.go @@ -657,12 +657,16 @@ func (device *iotDevice) Init() bool { if strings.Contains(device.Servers, "tls") || strings.Contains(device.Servers, "ssl") { glog.Infof("server support tls connection") if device.ServerCert != nil { - certPool:=x509.NewCertPool() + certPool := x509.NewCertPool() certPool.AppendCertsFromPEM(device.ServerCert) options.SetTLSConfig(&tls.Config{ - RootCAs: certPool, + RootCAs: certPool, InsecureSkipVerify: false, }) + } else { + options.SetTLSConfig(&tls.Config{ + InsecureSkipVerify: true, + }) } } else { options.SetTLSConfig(&tls.Config{