aboutsummaryrefslogtreecommitdiff
path: root/src/net/dnsclient_unix.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2015-07-15 17:02:06 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2015-07-16 20:56:23 +0000
commitadb1e030136f14ef8434930f15a04a74568a5948 (patch)
tree151bd701e8667cb404bcf8ff836e5165f8a64eef /src/net/dnsclient_unix.go
parent29eb7d18ed71c057bbdb69d85953a32252f0ea73 (diff)
downloadgo-adb1e030136f14ef8434930f15a04a74568a5948.tar.gz
go-adb1e030136f14ef8434930f15a04a74568a5948.zip
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>
Diffstat (limited to 'src/net/dnsclient_unix.go')
-rw-r--r--src/net/dnsclient_unix.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net/dnsclient_unix.go b/src/net/dnsclient_unix.go
index 8f636055ab9..6b775f713e8 100644
--- a/src/net/dnsclient_unix.go
+++ b/src/net/dnsclient_unix.go
@@ -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