tailcfg: add a field to advertise support for IPv6 tailscale config.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson 2020-10-15 21:11:57 +00:00 committed by Dave Anderson
parent 7a2a3955d3
commit c6dbd24f67
2 changed files with 25 additions and 19 deletions

View File

@ -45,6 +45,10 @@
"tailscale.com/version" "tailscale.com/version"
) )
var (
enableV6Overlay, _ = strconv.ParseBool(os.Getenv("TS_DEBUG_ENABLE_IPV6_OVERLAY"))
)
type Persist struct { type Persist struct {
_ structs.Incomparable _ structs.Incomparable
@ -525,15 +529,16 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*NetworkM
} }
request := tailcfg.MapRequest{ request := tailcfg.MapRequest{
Version: 4, Version: 4,
IncludeIPv6: true, IncludeIPv6: true,
DeltaPeers: true, IncludeIPv6Overlay: enableV6Overlay,
KeepAlive: c.keepAlive, DeltaPeers: true,
NodeKey: tailcfg.NodeKey(persist.PrivateNodeKey.Public()), KeepAlive: c.keepAlive,
DiscoKey: c.discoPubKey, NodeKey: tailcfg.NodeKey(persist.PrivateNodeKey.Public()),
Endpoints: ep, DiscoKey: c.discoPubKey,
Stream: allowStream, Endpoints: ep,
Hostinfo: hostinfo, Stream: allowStream,
Hostinfo: hostinfo,
} }
if c.newDecompressor != nil { if c.newDecompressor != nil {
request.Compress = "zstd" request.Compress = "zstd"

View File

@ -461,16 +461,17 @@ type RegisterResponse struct {
// using the local machine key, and sent to: // using the local machine key, and sent to:
// https://login.tailscale.com/machine/<mkey hex>/map // https://login.tailscale.com/machine/<mkey hex>/map
type MapRequest struct { type MapRequest struct {
Version int // current version is 4 Version int // current version is 4
Compress string // "zstd" or "" (no compression) Compress string // "zstd" or "" (no compression)
KeepAlive bool // whether server should send keep-alives back to us KeepAlive bool // whether server should send keep-alives back to us
NodeKey NodeKey NodeKey NodeKey
DiscoKey DiscoKey DiscoKey DiscoKey
Endpoints []string // caller's endpoints (IPv4 or IPv6) Endpoints []string // caller's endpoints (IPv4 or IPv6)
IncludeIPv6 bool // include IPv6 endpoints in returned Node Endpoints IncludeIPv6 bool // include IPv6 endpoints in returned Node Endpoints
DeltaPeers bool // whether the 2nd+ network map in response should be deltas, using PeersChanged, PeersRemoved IncludeIPv6Overlay bool // include IPv6 Addresses and AllowedIPs in returned Nodes.
Stream bool // if true, multiple MapResponse objects are returned DeltaPeers bool // whether the 2nd+ network map in response should be deltas, using PeersChanged, PeersRemoved
Hostinfo *Hostinfo Stream bool // if true, multiple MapResponse objects are returned
Hostinfo *Hostinfo
// ReadOnly is whether the client just wants to fetch the // ReadOnly is whether the client just wants to fetch the
// MapResponse, without updating their Endpoints. The // MapResponse, without updating their Endpoints. The