Remove trailing . of hostnames.

This commit is contained in:
Martin Dosch 2021-03-03 22:05:47 +01:00
parent 4ac87d88e1
commit 9044bbb998

View File

@ -44,8 +44,8 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
if _, addrs, err := net.LookupSRV("xmpp-client", "tcp", server); err == nil {
if len(addrs) > 0 {
for _, adr := range addrs {
srvMixed = append(srvMixed, srv{adr.Target, false,
adr.Port, adr.Priority, adr.Weight})
srvMixed = append(srvMixed, srv{strings.TrimSuffix(adr.Target, "."),
false, adr.Port, adr.Priority, adr.Weight})
}
}
}
@ -54,8 +54,9 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
if len(addrs) > 0 {
if addrs[0].Target != "." {
for _, adr := range addrs {
srvMixed = append(srvMixed, srv{adr.Target, true,
adr.Port, adr.Priority, adr.Weight})
srvMixed = append(srvMixed,
srv{strings.TrimSuffix(adr.Target, "."), true, adr.Port,
adr.Priority, adr.Weight})
}
}
}