• Eugene Kalinin's avatar
    net: make cgo resolver work more accurately with network parameter · c659be4d
    Eugene Kalinin authored
    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/120215Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    c659be4d
transport_test.go 130 KB