-
Notifications
You must be signed in to change notification settings - Fork 18k
net: Dial always query DNS for both A and AAAA even if network is tcp4 or tcp6 when pure Go resolver is used #45024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
Change https://golang.org/cl/301709 mentions this issue: |
Here is my test code: (build it with package main
import "net"
func main() {
net.Dial("tcp4", "golang.org:80")
} Dump from wireshark:
|
cc @bradfitz |
cc @ekalinin |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
When pure Go resolver is used, net.Dial always send two DNS query (one for A record and another for AAAA), even if the
network
parameter set to one oftcp4
,tcp6
,udp4
,udp6
. This will add extra latencies when making IPv4-only or IPv6-only connections. In the worst case, for example, a pure IPv4 host with firewall filtered out all AAAA queries, a dial withtcp4
will have to wait 10 second until AAAA query timed out.The same problem was also found in cgo resolver (#25947), and it was fixed in c659be4.
My pull request will fix this.
The text was updated successfully, but these errors were encountered: