From e7655f1df0771d1d9ed080b4bad56dfe896429ea Mon Sep 17 00:00:00 2001 From: mzack Date: Tue, 25 Jan 2022 20:57:54 +0100 Subject: [PATCH] fixing tls config generation --- v2/pkg/protocols/ssl/ssl.go | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/v2/pkg/protocols/ssl/ssl.go b/v2/pkg/protocols/ssl/ssl.go index dc4d2f1b6..996acd124 100644 --- a/v2/pkg/protocols/ssl/ssl.go +++ b/v2/pkg/protocols/ssl/ssl.go @@ -138,24 +138,29 @@ func (request *Request) ExecuteWithResults(input string, dynamicValues, previous return err } 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 { + 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) } else { - var config *tls.Config - config, err = fastdialer.AsTLSConfig(zconfig) - if err != nil { - return err + config := &tls.Config{InsecureSkipVerify: true, ServerName: hostname} + if minVersion > 0 { + config.MinVersion = minVersion + } + if maxVersion > 0 { + config.MaxVersion = maxVersion + } + if len(config.CipherSuites) > 0 { + config.CipherSuites = cipherSuites } conn, err = request.dialer.DialTLSWithConfig(context.Background(), "tcp", addressToDial, config) }