|
|
|
@ -15,7 +15,6 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
|
|
|
|
|
server := options.User[strings.LastIndex(options.User, "@")+1:]
|
|
|
|
|
// Lookup xmpp-client SRV records if direct TLS is not required
|
|
|
|
|
if !directTLS {
|
|
|
|
|
// TODO: Fallback to 5222 if no xmpp-client SRV records exist
|
|
|
|
|
if _, addrs, err := net.LookupSRV("xmpp-client", "tcp", server); err == nil {
|
|
|
|
|
if len(addrs) > 0 {
|
|
|
|
|
for _, adr := range addrs {
|
|
|
|
@ -28,6 +27,13 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Try port 5222 if no xmpp-client SRV records are provided.
|
|
|
|
|
options.Host = server + ":5222"
|
|
|
|
|
// Connect to server
|
|
|
|
|
client, err := options.NewClient()
|
|
|
|
|
if err == nil {
|
|
|
|
|
return client, err
|
|
|
|
|
}
|
|
|
|
|
// Unset STartTLS as we try direct TLS now
|
|
|
|
|
options.NoTLS = false
|
|
|
|
|
options.StartTLS = false
|
|
|
|
|