Commit 20692c22 authored by Mikio Hara's avatar Mikio Hara

net: add addrList

This CL adds a new type addrList that will carry a short list of IP
addresses to dial helper functions in the upcoming CLs.

This is in preparation for TCP connection setup with fast failover on
dual IP stack node as described in RFC 6555.

Update #3610
Update #5267

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13241046
parent 9456adb3
......@@ -40,6 +40,24 @@ type netaddr interface {
toAddr() Addr
}
// An addrList represents a list of network endpoint addresses.
type addrList []netaddr
func (al addrList) toAddr() Addr {
switch len(al) {
case 0:
return nil
case 1:
return al[0].toAddr()
default:
// For now, we'll roughly pick first one without
// considering dealing with any preferences such as
// DNS TTL, transport path quality, network routing
// information.
return al[0].toAddr()
}
}
var errNoSuitableAddress = errors.New("no suitable address found")
// firstFavoriteAddr returns an address that implemets netaddr
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment