net: LookupHost and Resolve{TCP,UDP,IP}Addr should use zone from getaddrinfo

The unix and windows getaddrinfo calls return a zone with IPv6
addresses. IPv6 link-local addresses returned are only valid on the
given zone. When the zone is dropped, connections to the address
will fail. This patch replaces IP with IPAddr in several internal
resolver functions, and plumbs through the zone.

Change-Id: Ifea891654f586f15b76988464f82e04a42ccff6d
Reviewed-on: https://go-review.googlesource.com/5851
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
This commit is contained in:
Andrew Pilloud 2015-02-12 20:24:47 -08:00 committed by Mikio Hara
parent cbc854a799
commit f00362b9ec
10 changed files with 132 additions and 119 deletions

View file

@ -60,7 +60,7 @@ func lookupHost(host string) (addrs []string, err error) {
return
}
func lookupIP(host string) (addrs []IP, err error) {
func lookupIP(host string) (addrs []IPAddr, err error) {
addrs, err, ok := cgoLookupIP(host)
if !ok {
addrs, err = goLookupIP(host)