use ServerName to verify tls hostname (#127)

This commit is contained in:
marzzzello 2021-01-21 09:27:23 +01:00 committed by GitHub
parent 42ee290fc5
commit b40e129499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -241,6 +241,7 @@ func (o Options) NewClient() (*Client, error) {
var tlsconn *tls.Conn var tlsconn *tls.Conn
if o.TLSConfig != nil { if o.TLSConfig != nil {
tlsconn = tls.Client(c, o.TLSConfig) tlsconn = tls.Client(c, o.TLSConfig)
host = o.TLSConfig.ServerName
} else { } else {
newconfig := DefaultConfig.Clone() newconfig := DefaultConfig.Clone()
newconfig.ServerName = host newconfig.ServerName = host