You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there's no way to do a DNS lookup with a deadline or duration that the
request must finish within. This would be useful when the user wants to control DNS
lookups at a finer grained level separate from connections and requests.
There is a lookupHostDeadline function in net/lookup.go, but it is not exposed to the
user.
lookupHostDeadline has a TODO inside it to bring the deadlining down into the name
resolution functions themselves, so solving this issue could involve solving that. Even
an exposed API with the TODO in place would allow users to benefit from future fixes.
This is related to the now closed issue #2631.
The text was updated successfully, but these errors were encountered:
There are nine Lookup functions in package net. This would mean adding nine new
functions, taking timeouts.
To understand your motivation for wanting this, were you actually hitting problems with
the number of fds or threads for the DNS/cgo calls?
And which OS? On Linux at least we could use getaddrinfo_a (see
http://www.imperialviolet.org/2005/06/01/asynchronous-dns-lookups-with-glibc.html and
http://www.kernel.org/doc/man-pages/online/pages/man3/getaddrinfo_a.3.html) but even
that API doesn't really seem to do timeouts efficiently, probably because the underlying
NSS / resolver(3) mechanisms don't really support timeouts.
Your best bet probably is to not use the system's DNS facilities and use a pure Go DNS
resolver (maybe https://github.com/miekg/dns, which seems popular), where you'll have
more control.
I really think using github.com/miekg/dns is your best bet. We don't even have timeout
control in package net on most systems since we're calling into the C library.
The text was updated successfully, but these errors were encountered: