]> Cypherpunks repositories - gostls13.git/commit
net: make cgo resolver work more accurately with network parameter
authorEugene Kalinin <e.v.kalinin@gmail.com>
Wed, 20 Jun 2018 22:23:37 +0000 (01:23 +0300)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 25 Oct 2018 03:14:03 +0000 (03:14 +0000)
commitc659be4dc862cdf14a24134f2cfc16fa81e6d84c
treefb0200ce7fa6e9b5f3ad066e0da1589538ca2c57
parentfc4f2e5692ab800a450e07c3d983eda02dfd4711
net: make cgo resolver work more accurately with network parameter

Unlike the go resolver, the existing cgo resolver exchanges both DNS A
and AAAA RR queries unconditionally and causes unreasonable connection
setup latencies to applications using the cgo resolver.

This change adds new argument (`network`) in all functions through the
series of calls: from Resolver.internetAddrList to cgoLookupIPCNAME.

Benefit: no redundant DNS calls if certain IP version is used IPv4/IPv6
(no `AAAA` DNS requests if used tcp4, udp4, ip4 network. And vice
versa: no `A` DNS requests if used tcp6, udp6, ip6 network)

Fixes #25947

Change-Id: I39edbd726d82d6133fdada4d06cd90d401e7e669
Reviewed-on: https://go-review.googlesource.com/c/120215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
15 files changed:
src/net/cgo_stub.go
src/net/cgo_unix.go
src/net/cgo_unix_test.go
src/net/dial_test.go
src/net/error_test.go
src/net/hook.go
src/net/http/transport_test.go
src/net/ipsock.go
src/net/lookup.go
src/net/lookup_fake.go
src/net/lookup_plan9.go
src/net/lookup_test.go
src/net/lookup_unix.go
src/net/lookup_windows.go
src/net/netgo_unix_test.go