Fall back to direct TLS on port 5223

Fall back to direct TLS on port 5223 if direct tls is set and no SRV
records are provided.
errwrp
Martin Dosch 1 year ago
parent fa64886509
commit 8f844b1cde
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -10,6 +10,7 @@
- Allow JIDs without localpart.
- Use single quotes for attributes in stanzas created by github.com/beevik/etree (vial etree v1.1.4).
- Fix SRV lookup when the domain has a CNAME (via xmppsrv v0.2.5).
- Fall back to directTLS on port 5223 (instead of StartTLS on port 5222) if no SRV records are provided and `-t` is set.
## [v0.5.6] 2022-11-11
### Added

@ -46,13 +46,23 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
}
}
}
// Try port 5222 if no xmpp-client SRV records are provided.
options.NoTLS = true
options.StartTLS = true
options.Host = net.JoinHostPort(server, "5222")
// Connect to server
client, err := options.NewClient()
return client, err
// Try port 5223 if directTLS is set and no xmpp-client SRV records are provided.
if directTLS {
options.NoTLS = false
options.StartTLS = false
options.Host = net.JoinHostPort(server, "5223")
// Connect to server
client, err := options.NewClient()
return client, err
} else {
// Try port 5222 if no xmpp-client SRV records are provided and directTLS is not set.
options.NoTLS = true
options.StartTLS = true
options.Host = net.JoinHostPort(server, "5222")
// Connect to server
client, err := options.NewClient()
return client, err
}
}
// Connect to server
client, err := options.NewClient()

Loading…
Cancel
Save