ipn/ipnlocal: move C2NUpdateResponse to c2ntypes.go (#9112)

Updates #cleanup

Signed-off-by: Chris Palmer <cpalmer@tailscale.com>
pull/9116/head
Chris Palmer 1 year ago committed by GitHub
parent d74c771fda
commit 346dc5f37e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 // TODO(bradfitz): add some sort of semaphore that prevents two concurrent
// updates, or if one happened in the past 5 minutes, or something. // updates, or if one happened in the past 5 minutes, or something.
// TODO(bradfitz): move this type to some leaf package var res tailcfg.C2NUpdateResponse
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
res.Enabled = envknob.AllowsRemoteUpdate() res.Enabled = envknob.AllowsRemoteUpdate()
res.Supported = runtime.GOOS == "windows" || (runtime.GOOS == "linux" && distro.Get() == distro.Debian) res.Supported = runtime.GOOS == "windows" || (runtime.GOOS == "linux" && distro.Get() == distro.Debian)

@ -33,3 +33,22 @@ type C2NSSHUsernamesResponse struct {
// just a best effort set of hints. // just a best effort set of hints.
Usernames []string 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
}

Loading…
Cancel
Save