Improve behavior when no SRV records are set.

no-tls
Martin Dosch 3 months ago
parent 38bf2d54a8
commit e38acf3e92
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -16,9 +16,9 @@ import (
func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
proxy := os.Getenv("HTTP_PROXY")
server := options.User[strings.Index(options.User, "@")+1:]
// Look up SRV records if server is not specified manually.
if options.Host == "" {
server := options.User[strings.Index(options.User, "@")+1:]
// Don't do SRV look ups if proxy is set.
if proxy == "" {
// Look up xmpp-client SRV records.
@ -46,6 +46,9 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
}
_, port, _ := net.SplitHostPort(options.Host)
if port == "" {
if options.Host == "" {
options.Host = server
}
// Try port 5223 if directTLS is set and no port is provided.
if directTLS {
options.NoTLS = false

Loading…
Cancel
Save