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
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 of tcp4, 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 with tcp4 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:
Here is my test code: (build it with CGO_ENABLED=0 go build test46.go)
package main
import"net"funcmain() {
net.Dial("tcp4", "golang.org:80")
}
Dump from wireshark:
No. Time Source Destination Protocol Length Info
11 3.196111458 127.0.0.1 127.0.0.53 DNS 70 Standard query 0x668e AAAA golang.org
12 3.196261224 127.0.0.1 127.0.0.53 DNS 70 Standard query 0x5811 A golang.org
cherrymui
changed the title
net.Dial always query DNS for both A and AAAA even if network is tcp4 or tcp6 when pure Go resolver is used
net: Dial always query DNS for both A and AAAA even if network is tcp4 or tcp6 when pure Go resolver is used
Mar 15, 2021
cherrymui
added
the
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
label
Mar 15, 2021
odeke-em
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
labels
Mar 23, 2021
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: