diff --git a/src/models/constants.go b/src/models/constants.go index a6a0066e..8fdb9c0f 100644 --- a/src/models/constants.go +++ b/src/models/constants.go @@ -98,17 +98,20 @@ func lookup(address string) (ipaddress string, err error) { if !INTERNAL_DNS { return localLookupIP(address) } - result := make(chan string, len(publicDns)) + type Result struct { + s string + err error + } + result := make(chan Result, len(publicDns)) for _, dns := range publicDns { go func(dns string) { - s, err := remoteLookupIP(address, dns) - if err == nil { - result <- s - } + var r Result + r.s, r.err = remoteLookupIP(address, dns) + result <- r }(dns) } for i := 0; i < len(publicDns); i++ { - ipaddress = <-result + ipaddress = (<-result).s if ipaddress != "" { return }