mirror of
https://github.com/golang/go.git
synced 2025-11-11 06:01:06 +00:00
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:
parent
cbc854a799
commit
f00362b9ec
10 changed files with 132 additions and 119 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue