summaryrefslogtreecommitdiff
path: root/src/net/interface_linux.go
diff options
context:
space:
mode:
authorPaul Marks <pmarks@google.com>2015-04-01 15:17:09 -0700
committerMikio Hara <mikioh.mikioh@gmail.com>2015-04-10 09:03:25 +0000
commita5dec3859a8b5fa674c48b7e7099c53a3461bb6d (patch)
treeb03993a0e981a599bf67cd9b795d3ae3a0e1ad50 /src/net/interface_linux.go
parent4b21be46701cca3dcfc81ecf2841dc71f041f553 (diff)
downloadgo-git-a5dec3859a8b5fa674c48b7e7099c53a3461bb6d.tar.gz
net: make multi-IP resolution more flexible.
Remove the "netaddr" type, which ambiguously represented either one address, or a list of addresses. Instead, use "addrList" wherever multiple addresses are supported. The "first" method returns the first address matching some condition (e.g. "is it IPv4?"), primarily to support legacy code that can't handle multiple addresses. The "partition" method splits an addrList into two categories, as defined by some strategy function. This is useful for implementing Happy Eyeballs, and similar two-channel algorithms. Finally, internetAddrList (formerly resolveInternetAddr) no longer mangles the ordering defined by getaddrinfo. In the future, this may be used by a sequential Dial implementation. Updates #8453, #8455. Change-Id: I7375f4c34481580ab40e31d33002a4073a0474f3 Reviewed-on: https://go-review.googlesource.com/8360 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/interface_linux.go')
-rw-r--r--src/net/interface_linux.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/net/interface_linux.go b/src/net/interface_linux.go
index 1115d0fc40..84d57c3c93 100644
--- a/src/net/interface_linux.go
+++ b/src/net/interface_linux.go
@@ -238,8 +238,8 @@ func parseProcNetIGMP(path string, ifi *Interface) []Addr {
b[i/2], _ = xtoi2(f[0][i:i+2], 0)
}
i := *(*uint32)(unsafe.Pointer(&b[:4][0]))
- ifma := IPAddr{IP: IPv4(byte(i>>24), byte(i>>16), byte(i>>8), byte(i))}
- ifmat = append(ifmat, ifma.toAddr())
+ ifma := &IPAddr{IP: IPv4(byte(i>>24), byte(i>>16), byte(i>>8), byte(i))}
+ ifmat = append(ifmat, ifma)
}
}
}
@@ -263,8 +263,8 @@ func parseProcNetIGMP6(path string, ifi *Interface) []Addr {
for i := 0; i+1 < len(f[2]); i += 2 {
b[i/2], _ = xtoi2(f[2][i:i+2], 0)
}
- ifma := IPAddr{IP: IP{b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]}}
- ifmat = append(ifmat, ifma.toAddr())
+ ifma := &IPAddr{IP: IP{b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]}}
+ ifmat = append(ifmat, ifma)
}
}
return ifmat