proposal: net: add context/timeout/deadline for Resolve* #18947
Closed
Labels
Comments
Possibly dup of #6340 (6 Sep 2013). Should I leave this issue open? |
Okay... there is |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
To resolve an address, it needs a communication between local host and name server. When the routes changed or something else makes the address being unreachable, or there is loss of UDP datagram, there will be a high delay (maybe the goroutine will never wake up again).
What I can do now is use
net.DialContext()
with a deadline ornet.Dialer
. But when I want to only resolve the host name/domain,net.Resolve*Addr()
ornet.Lookup*()
never timeout.I read source code of
net
and I foundnet.Resolve*Addr()
does have some code about context:Can we export the context argument?
Maybe add something like
net.ResolveTCPAddrContext()
? or an interface called, maybe,Resolver
?Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.7.4
What operating system and processor architecture are you using (
go env
)?The text was updated successfully, but these errors were encountered: