From 666d404066f534ed1a0b6fcc67149a87931602b2 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 20 Jun 2020 10:18:13 -0700 Subject: [PATCH] ipn: put discovery key generation behind an environment flag for now Later we'll want to use the presence of a discovery key as a signal that the node knows how to participate in discovery. Currently the code generates keys and sends them to the control server but doesn't do anything with them, which is a bad state to stay in lest we release this code and end up with nodes in the future that look like they're functional with the new discovery protocol but aren't. So for now, make this opt-in as a debug option for now, until the rest of it is in. Updates #483 --- ipn/local.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ipn/local.go b/ipn/local.go index ad04e4aee..899f42951 100644 --- a/ipn/local.go +++ b/ipn/local.go @@ -8,6 +8,8 @@ import ( "context" "errors" "fmt" + "os" + "strconv" "strings" "sync" "time" @@ -358,9 +360,12 @@ func (b *LocalBackend) Start(opts Options) error { b.updateFilter(nil) - discoPrivate := key.NewPrivate() - b.e.SetDiscoPrivateKey(discoPrivate) - discoPublic := tailcfg.DiscoKey(discoPrivate.Public()) + var discoPublic tailcfg.DiscoKey + if useDisco, _ := strconv.ParseBool(os.Getenv("TS_DEBUG_USE_DISCO")); useDisco { + discoPrivate := key.NewPrivate() + b.e.SetDiscoPrivateKey(discoPrivate) + discoPublic = tailcfg.DiscoKey(discoPrivate.Public()) + } var err error if persist == nil {