net: make Resolver.PreferGo work more as documented

Fixes #24393

Change-Id: I8bcee34cdf30472663d866ed6056301d8445215c
Reviewed-on: https://go-review.googlesource.com/100875
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Brad Fitzpatrick 2018-03-15 09:27:29 +03:00
parent 86a338960d
commit 0b20aece1a
4 changed files with 25 additions and 8 deletions

View file

@ -524,7 +524,7 @@ func goLookupIPFiles(name string) (addrs []IPAddr) {
// goLookupIP is the native Go implementation of LookupIP.
// The libc versions are in cgo_*.go.
func (r *Resolver) goLookupIP(ctx context.Context, host string) (addrs []IPAddr, err error) {
order := systemConf().hostLookupOrder(host)
order := systemConf().hostLookupOrder(r, host)
addrs, _, err = r.goLookupIPCNAMEOrder(ctx, host, order)
return
}
@ -676,7 +676,7 @@ func (r *Resolver) goLookupIPCNAMEOrder(ctx context.Context, name string, order
// goLookupCNAME is the native Go (non-cgo) implementation of LookupCNAME.
func (r *Resolver) goLookupCNAME(ctx context.Context, host string) (string, error) {
order := systemConf().hostLookupOrder(host)
order := systemConf().hostLookupOrder(r, host)
_, cname, err := r.goLookupIPCNAMEOrder(ctx, host, order)
return cname.String(), err
}