fixing tls config generation

This commit is contained in:
mzack 2022-01-25 20:57:54 +01:00
parent a6798f37ad
commit e7655f1df0

View File

@ -138,24 +138,29 @@ func (request *Request) ExecuteWithResults(input string, dynamicValues, previous
return err return err
} }
var conn net.Conn var conn net.Conn
zconfig := &ztls.Config{InsecureSkipVerify: true, ServerName: hostname}
if minVersion > 0 {
zconfig.MinVersion = minVersion
}
if maxVersion > 0 {
zconfig.MaxVersion = maxVersion
}
if len(zconfig.CipherSuites) > 0 {
zconfig.CipherSuites = cipherSuites
}
if request.options.Options.ZTLS { if request.options.Options.ZTLS {
zconfig := &ztls.Config{InsecureSkipVerify: true, ServerName: hostname}
if minVersion > 0 {
zconfig.MinVersion = minVersion
}
if maxVersion > 0 {
zconfig.MaxVersion = maxVersion
}
if len(zconfig.CipherSuites) > 0 {
zconfig.CipherSuites = cipherSuites
}
conn, err = request.dialer.DialZTLSWithConfig(context.Background(), "tcp", addressToDial, zconfig) conn, err = request.dialer.DialZTLSWithConfig(context.Background(), "tcp", addressToDial, zconfig)
} else { } else {
var config *tls.Config config := &tls.Config{InsecureSkipVerify: true, ServerName: hostname}
config, err = fastdialer.AsTLSConfig(zconfig) if minVersion > 0 {
if err != nil { config.MinVersion = minVersion
return err }
if maxVersion > 0 {
config.MaxVersion = maxVersion
}
if len(config.CipherSuites) > 0 {
config.CipherSuites = cipherSuites
} }
conn, err = request.dialer.DialTLSWithConfig(context.Background(), "tcp", addressToDial, config) conn, err = request.dialer.DialTLSWithConfig(context.Background(), "tcp", addressToDial, config)
} }