mirror of https://github.com/tailscale/tailscale/
client/web: show features based on platform support
Hiding/disabling UI features when not available on the running client. Updates #10261 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>pull/10442/head
parent
7d61b827e8
commit
7a4ba609d9
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
/**
|
||||||
|
* assertNever ensures a branch of code can never be reached,
|
||||||
|
* resulting in a Typescript error if it can.
|
||||||
|
*/
|
||||||
|
export function assertNever(a: never): never {
|
||||||
|
return a
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
package envknob
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"tailscale.com/version"
|
||||||
|
"tailscale.com/version/distro"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CanRunTailscaleSSH reports whether serving a Tailscale SSH server is
|
||||||
|
// supported for the current os/distro.
|
||||||
|
func CanRunTailscaleSSH() error {
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "linux":
|
||||||
|
if distro.Get() == distro.Synology && !UseWIPCode() {
|
||||||
|
return errors.New("The Tailscale SSH server does not run on Synology.")
|
||||||
|
}
|
||||||
|
if distro.Get() == distro.QNAP && !UseWIPCode() {
|
||||||
|
return errors.New("The Tailscale SSH server does not run on QNAP.")
|
||||||
|
}
|
||||||
|
// otherwise okay
|
||||||
|
case "darwin":
|
||||||
|
// okay only in tailscaled mode for now.
|
||||||
|
if version.IsSandboxedMacOS() {
|
||||||
|
return errors.New("The Tailscale SSH server does not run in sandboxed Tailscale GUI builds.")
|
||||||
|
}
|
||||||
|
case "freebsd", "openbsd":
|
||||||
|
default:
|
||||||
|
return errors.New("The Tailscale SSH server is not supported on " + runtime.GOOS)
|
||||||
|
}
|
||||||
|
if !CanSSHD() {
|
||||||
|
return errors.New("The Tailscale SSH server has been administratively disabled.")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in New Issue