Fix XMPP TLS config
This commit is contained in:
parent
87ff01ac68
commit
d0f2b492ac
|
@ -35,11 +35,13 @@ func (t XMPPTransport) IsSecure() bool {
|
||||||
|
|
||||||
func (t *XMPPTransport) StartTLS(domain string) error {
|
func (t *XMPPTransport) StartTLS(domain string) error {
|
||||||
if t.Config.TLSConfig == nil {
|
if t.Config.TLSConfig == nil {
|
||||||
t.Config.TLSConfig = &tls.Config{}
|
t.TLSConfig = &tls.Config{}
|
||||||
|
} else {
|
||||||
|
t.TLSConfig = t.Config.TLSConfig.Clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.Config.TLSConfig.ServerName == "" {
|
if t.TLSConfig.ServerName == "" {
|
||||||
t.Config.TLSConfig.ServerName = domain
|
t.TLSConfig.ServerName = domain
|
||||||
}
|
}
|
||||||
tlsConn := tls.Client(t.conn, t.TLSConfig)
|
tlsConn := tls.Client(t.conn, t.TLSConfig)
|
||||||
// We convert existing connection to TLS
|
// We convert existing connection to TLS
|
||||||
|
|
Loading…
Reference in a new issue