Skip to content

Commit

Permalink
add flag to skiup tls verfication in paho client
Browse files Browse the repository at this point in the history
  • Loading branch information
DerPate authored and pmalhaire committed Jul 9, 2024
1 parent 077fa73 commit 4c6bafd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type conf struct {
clientCertPath string
// path to client cert key file
clientCertKeyPath string
// wether to skip the cert validity check
skipTlsValidation bool

Check warning on line 56 in client.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: struct field skipTlsValidation should be skipTLSValidation (revive)
}

const (
Expand Down Expand Up @@ -161,6 +163,10 @@ func (m *MqttAPI) client(c goja.ConstructorCall) *goja.Object {
if err != nil {
common.Throw(m.vu.Runtime(), err)
}

skipTls := c.Argument(10)

Check warning on line 167 in client.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: var skipTls should be skipTLS (revive)
clientConf.skipTlsValidation = skipTls.ToBoolean()

client := &client{
vu: m.vu,
metrics: &metrics,
Expand Down Expand Up @@ -229,6 +235,11 @@ func (c *client) Connect() error {
}
}
}

tlsConfig = &tls.Config{

Check failure on line 239 in client.go

View workflow job for this annotation

GitHub Actions / lint

SA4031(related information): this is the value of tlsConfig (staticcheck)
InsecureSkipVerify: c.conf.skipTlsValidation,
}

if tlsConfig != nil {

Check failure on line 243 in client.go

View workflow job for this annotation

GitHub Actions / lint

SA4031: this nil check is always true (staticcheck)
opts.SetTLSConfig(tlsConfig)
}
Expand Down

0 comments on commit 4c6bafd

Please sign in to comment.