Quickfix for build error

See #94
This commit is contained in:
Mickael Remond 2019-07-27 09:22:04 -07:00
parent fe6cea870d
commit 7deaf59642
No known key found for this signature in database
GPG key ID: E6F6045D79965AA3

View file

@ -99,17 +99,17 @@ func NewClient(config Config, r *Router) (c *Client, err error) {
// fallback to jid domain // fallback to jid domain
if config.Address == "" { if config.Address == "" {
config.Address = config.parsedJid.Domain config.Address = config.parsedJid.Domain
// fetch srv DNS-Entries // fetch srv DNS-Entries
_, srvEntries, err := net.LookupSRV("xmpp-client", "tcp", config.parsedJid.Domain) _, srvEntries, err := net.LookupSRV("xmpp-client", "tcp", config.parsedJid.Domain)
if err == nil && len(srvEntries) > 0 { if err == nil && len(srvEntries) > 0 {
// if find some use the entry with heightest weight // if find some use the entry with heightest weight
bestSrv := srvEntries[0] bestSrv := srvEntries[0]
for _, srv := range srvEntries { for _, srv := range srvEntries {
if srv.Priority <= bestSrv.Priority && srv.Weight >= bestSrv.Weight { if srv.Priority <= bestSrv.Priority && srv.Weight >= bestSrv.Weight {
bestSrv = srv bestSrv = srv
config.Address = ensurePort(srv.Target, srv.Port) config.Address = ensurePort(srv.Target, int(srv.Port))
} }
} }
} }