From 346dc5f37efd462885f31c3c618243d4c61511fc Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Mon, 28 Aug 2023 11:30:55 -0700 Subject: [PATCH] ipn/ipnlocal: move C2NUpdateResponse to c2ntypes.go (#9112) Updates #cleanup Signed-off-by: Chris Palmer --- ipn/ipnlocal/c2n.go | 9 +-------- tailcfg/c2ntypes.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ipn/ipnlocal/c2n.go b/ipn/ipnlocal/c2n.go index 0810eb9a1..4559a8461 100644 --- a/ipn/ipnlocal/c2n.go +++ b/ipn/ipnlocal/c2n.go @@ -115,14 +115,7 @@ func (b *LocalBackend) handleC2NUpdate(w http.ResponseWriter, r *http.Request) { // TODO(bradfitz): add some sort of semaphore that prevents two concurrent // updates, or if one happened in the past 5 minutes, or something. - // TODO(bradfitz): move this type to some leaf package - type updateResponse struct { - Err string // error message, if any - Enabled bool // user has opted-in to remote updates - Supported bool // Tailscale supports updating this OS/platform - Started bool - } - var res updateResponse + var res tailcfg.C2NUpdateResponse res.Enabled = envknob.AllowsRemoteUpdate() res.Supported = runtime.GOOS == "windows" || (runtime.GOOS == "linux" && distro.Get() == distro.Debian) diff --git a/tailcfg/c2ntypes.go b/tailcfg/c2ntypes.go index 0578299d7..108397378 100644 --- a/tailcfg/c2ntypes.go +++ b/tailcfg/c2ntypes.go @@ -33,3 +33,22 @@ type C2NSSHUsernamesResponse struct { // just a best effort set of hints. Usernames []string } + +// C2NUpdateResponse is the response (from node to control) from the /update +// handler. It tells control the status of its request for the node to update +// its Tailscale installation. +type C2NUpdateResponse struct { + // Err is the error message, if any. + Err string + + // Enabled indicates whether the user has opted in to updates triggered from + // control. + Enabled bool + + // Supported indicates whether remote updates are supported on this + // OS/platform. + Supported bool + + // Started indicates whether the update has started. + Started bool +}