mirror of
https://github.com/golang/go.git
synced 2025-11-10 21:51:05 +00:00
net: RFC 6724 address selection
At least the most important parts, I think. Fixes #10552 Change-Id: I1a03c5405bdbef337e0245d226e9247d3d067393 Reviewed-on: https://go-review.googlesource.com/12246 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
29eb7d18ed
commit
adb1e03013
3 changed files with 602 additions and 2 deletions
|
|
@ -419,12 +419,12 @@ func goLookupIPFiles(name string) (addrs []IPAddr) {
|
|||
addrs = append(addrs, addr)
|
||||
}
|
||||
}
|
||||
sortByRFC6724(addrs)
|
||||
return
|
||||
}
|
||||
|
||||
// goLookupIP is the native Go implementation of LookupIP.
|
||||
// Used only if cgoLookupIP refuses to handle the request
|
||||
// (that is, only if cgoLookupIP is the stub in cgo_stub.go).
|
||||
// The libc versions are in cgo_*.go.
|
||||
func goLookupIP(name string) (addrs []IPAddr, err error) {
|
||||
return goLookupIPOrder(name, hostLookupFilesDNS)
|
||||
}
|
||||
|
|
@ -458,6 +458,7 @@ func goLookupIPOrder(name string, order hostLookupOrder) (addrs []IPAddr, err er
|
|||
}
|
||||
addrs = append(addrs, addrRecordList(racer.rrs)...)
|
||||
}
|
||||
sortByRFC6724(addrs)
|
||||
if len(addrs) == 0 {
|
||||
if lastErr != nil {
|
||||
return nil, lastErr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue