net: DialTimeout is not able to connect when /etc/resolv.conf has some unreachable nameservers at the top #57694
What version of Go are you using (
The text was updated successfully, but these errors were encountered:
I added the 4th entry just to observe the behavior and to verify that Go code is actually reading all 3 entries. When I added debugging logs to the functions in net package, I can see that for some lookups it is attempting to connect to all 3 name servers, however functions seem to return with the timeout from the first entry.
In order to isolate the problem, I wrapped the net.DialTimeout call as follows with driver main.go program.
The timeout you provide as a argument causes a creation of a internal context inside the net package, which is passed to the address resolution.
I feel that it works as intended.