Improve fallback behavior if no SRV records are provided.

no-tls
Martin Dosch 4 months ago
parent dff738aeec
commit 6ea4de828f
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -5,6 +5,7 @@
- Properly handle lost connection.
- Better compatibility with perl sendxmpp config files.
- Improve file name for private Ox keys.
- Improve fallback behavior if no SRV records are provided.
## [v0.8.3] 2024-02-17
### Changed

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

Loading…
Cancel
Save