mirror of
https://github.com/golang/go.git
synced 2025-11-10 21:51:05 +00:00
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:
parent
86a338960d
commit
0b20aece1a
4 changed files with 25 additions and 8 deletions
|
|
@ -74,7 +74,7 @@ func (r *Resolver) dial(ctx context.Context, network, server string) (Conn, erro
|
|||
}
|
||||
|
||||
func (r *Resolver) lookupHost(ctx context.Context, host string) (addrs []string, err error) {
|
||||
order := systemConf().hostLookupOrder(host)
|
||||
order := systemConf().hostLookupOrder(r, host)
|
||||
if !r.PreferGo && order == hostLookupCgo {
|
||||
if addrs, err, ok := cgoLookupHost(ctx, host); ok {
|
||||
return addrs, err
|
||||
|
|
@ -89,7 +89,7 @@ func (r *Resolver) lookupIP(ctx context.Context, host string) (addrs []IPAddr, e
|
|||
if r.PreferGo {
|
||||
return r.goLookupIP(ctx, host)
|
||||
}
|
||||
order := systemConf().hostLookupOrder(host)
|
||||
order := systemConf().hostLookupOrder(r, host)
|
||||
if order == hostLookupCgo {
|
||||
if addrs, err, ok := cgoLookupIP(ctx, host); ok {
|
||||
return addrs, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue