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
pull/492/head
Brad Fitzpatrick 4 years ago
parent 00ca17edf4
commit 666d404066

@ -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 {

Loading…
Cancel
Save