control/controlclient, tailcfg: turn active route discovery on by default

Updates #483
pull/522/head
Brad Fitzpatrick 4 years ago
parent 3f74859bb0
commit c9089c82e8

@ -475,14 +475,15 @@ 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,
KeepAlive: c.keepAlive, KeepAlive: c.keepAlive,
NodeKey: tailcfg.NodeKey(persist.PrivateNodeKey.Public()), NodeKey: tailcfg.NodeKey(persist.PrivateNodeKey.Public()),
DiscoKey: c.discoPubKey, DiscoKey: c.discoPubKey,
Endpoints: ep, Endpoints: ep,
Stream: allowStream, Stream: allowStream,
Hostinfo: hostinfo, Hostinfo: hostinfo,
DebugForceDisco: Debug.ForceDisco,
} }
if c.newDecompressor != nil { if c.newDecompressor != nil {
request.Compress = "zstd" request.Compress = "zstd"
@ -782,17 +783,23 @@ func loadServerKey(ctx context.Context, httpc *http.Client, serverURL string) (w
var Debug = initDebug() var Debug = initDebug()
type debug struct { type debug struct {
NetMap bool NetMap bool
OnlyDisco bool OnlyDisco bool
Disco bool Disco bool
ForceDisco bool // ask control server to not filter out our disco key
} }
func initDebug() debug { func initDebug() debug {
return debug{ d := debug{
NetMap: envBool("TS_DEBUG_NETMAP"), NetMap: envBool("TS_DEBUG_NETMAP"),
OnlyDisco: os.Getenv("TS_DEBUG_USE_DISCO") == "only", OnlyDisco: os.Getenv("TS_DEBUG_USE_DISCO") == "only",
Disco: os.Getenv("TS_DEBUG_USE_DISCO") == "only" || envBool("TS_DEBUG_USE_DISCO"), ForceDisco: os.Getenv("TS_DEBUG_USE_DISCO") == "only" || envBool("TS_DEBUG_USE_DISCO"),
} }
if d.ForceDisco || os.Getenv("TS_DEBUG_USE_DISCO") == "" {
// This is now defaults to on.
d.Disco = true
}
return d
} }
func envBool(k string) bool { func envBool(k string) bool {

@ -454,6 +454,12 @@ type MapRequest struct {
IncludeIPv6 bool // include IPv6 endpoints in returned Node Endpoints IncludeIPv6 bool // include IPv6 endpoints in returned Node Endpoints
Stream bool // if true, multiple MapResponse objects are returned Stream bool // if true, multiple MapResponse objects are returned
Hostinfo *Hostinfo Hostinfo *Hostinfo
// DebugForceDisco is a temporary flag during the deployment
// of magicsock active discovery. It says that that the client
// has environment variables explicitly turning discovery on,
// so control should not disable it.
DebugForceDisco bool `json:"debugForceDisco,omitempty"`
} }
// PortRange represents a range of UDP or TCP port numbers. // PortRange represents a range of UDP or TCP port numbers.

Loading…
Cancel
Save