init empty TLSConfig, if nothing given

This commit is contained in:
Martin/Geno 2019-07-16 00:26:21 +02:00 committed by Mickaël Rémond
parent d36428fb2f
commit e05f36c69f

View file

@ -117,6 +117,10 @@ func (s *Session) startTlsIfSupported(conn net.Conn, domain string, o Config) ne
return conn return conn
} }
if o.TLSConfig == nil {
o.TLSConfig = &tls.Config{}
}
if o.TLSConfig.ServerName == "" { if o.TLSConfig.ServerName == "" {
o.TLSConfig.ServerName = domain o.TLSConfig.ServerName = domain
} }