From 323a158a7b83ec76695bbd815112138dc9a80e6f Mon Sep 17 00:00:00 2001 From: pmalhaire <7273249+pmalhaire@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:47:01 +0200 Subject: [PATCH] client.go fix lint issue --- client.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client.go b/client.go index 7f554b6..6ee50c2 100644 --- a/client.go +++ b/client.go @@ -53,7 +53,7 @@ type conf struct { // path to client cert key file clientCertKeyPath string // wether to skip the cert validity check - skipTlsValidation bool + skipTLSValidation bool } const ( @@ -164,8 +164,8 @@ func (m *MqttAPI) client(c goja.ConstructorCall) *goja.Object { common.Throw(m.vu.Runtime(), err) } - skipTls := c.Argument(10) - clientConf.skipTlsValidation = skipTls.ToBoolean() + skipTLS := c.Argument(10) + clientConf.skipTLSValidation = skipTLS.ToBoolean() client := &client{ vu: m.vu, @@ -236,8 +236,11 @@ func (c *client) Connect() error { } } - tlsConfig = &tls.Config{ - InsecureSkipVerify: c.conf.skipTlsValidation, + // set tls if skip is forced + if c.conf.skipTLSValidation { + tlsConfig = &tls.Config{ + InsecureSkipVerify: c.conf.skipTLSValidation, //nolint:gosec + } } if tlsConfig != nil {