control/controlclient, ipn/ipnlocal, tailcfg: add MapResponse.PopBrowserURL

Updates #3802

Change-Id: I89481fc5782a0cc8084354706f8f28d94f197325
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2022-03-21 14:10:25 -07:00
committed by Brad Fitzpatrick
parent 3ea6ddbb5f
commit f3b13604b3
4 changed files with 33 additions and 7 deletions

View File

@@ -973,6 +973,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
DebugFlags: debugFlags,
LinkMonitor: b.e.GetLinkMonitor(),
Pinger: b.e,
PopBrowserURL: b.tellClientToBrowseToURL,
// Don't warn about broken Linux IP forwarding when
// netstack is being used.
@@ -1370,12 +1371,18 @@ func (b *LocalBackend) popBrowserAuthNow() {
b.blockEngineUpdates(true)
b.stopEngineAndWait()
b.send(ipn.Notify{BrowseToURL: &url})
b.tellClientToBrowseToURL(url)
if b.State() == ipn.Running {
b.enterState(ipn.Starting)
}
}
func (b *LocalBackend) tellClientToBrowseToURL(url string) {
if url != "" {
b.send(ipn.Notify{BrowseToURL: &url})
}
}
// For testing lazy machine key generation.
var panicOnMachineKeyGeneration = envknob.Bool("TS_DEBUG_PANIC_MACHINE_KEY")