envknob
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package envknob provides access to environment-variable tweakabledebug settings.
These are primarily knobs used by Tailscale developers duringdevelopment or by users when instructed to by Tailscale developerswhen debugging something. They are not a stable interface and maybe removed or any time.
A related package, control/controlknobs, are knobs that can bechanged at runtime by the control plane. Sometimes both are used:an envknob for the default/explicit value, else falling backto the controlknob value.
Index¶
- func AllowsRemoteUpdate() bool
- func App() string
- func ApplyDiskConfig() (err error)
- func ApplyDiskConfigError() error
- func Bool(envVar string) bool
- func BoolDefaultTrue(envVar string) bool
- func CanSSHD() bool
- func CanTaildrop() bool
- func CrashOnUnexpected() bool
- func GOOS() string
- func IPCVersion() string
- func IsCertShareReadOnlyMode() bool
- func IsCertShareReadWriteMode() bool
- func LogCurrent(logf logf)
- func LookupBool(envVar string) (v bool, ok bool)
- func LookupInt(envVar string) (v int, ok bool)
- func LookupIntSized(envVar string, base, bitSize int) (v int, ok bool)
- func LookupUintSized(envVar string, base, bitSize int) (v uint, ok bool)
- func NoLogsNoSupport() bool
- func OptBool(envVar string) opt.Bool
- func PanicIfAnyEnvCheckedInInit()
- func RegisterBool(envVar string) func() bool
- func RegisterDuration(envVar string) func() time.Duration
- func RegisterInt(envVar string) func() int
- func RegisterOptBool(envVar string) func() opt.Bool
- func RegisterString(envVar string) func() string
- func SSHIgnoreTailnetPolicy() bool
- func SSHPolicyFile() string
- func SetNoLogsNoSupport()
- func Setenv(envVar, val string)
- func String(envVar string) string
- func TKASkipSignatureCheck() bool
- func UseWIPCode() bool
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcAllowsRemoteUpdate¶added inv1.36.0
func AllowsRemoteUpdate()bool
AllowsRemoteUpdate reports whether this node has opted-in to letting theTailscale control plane initiate a Tailscale update (e.g. on behalf of anadmin on the admin console).
funcApp¶added inv1.74.0
func App()string
App returns the tailscale app type of this instance, if set viaTS_INTERNAL_APP env var. TS_INTERNAL_APP can be used to set app type forcomponents that wrap tailscaled, such as containerboot. App type is intendedto only be used to set known predefined app types, such as TailscaleKubernetes Operator components.
funcApplyDiskConfig¶added inv1.32.0
func ApplyDiskConfig() (errerror)
ApplyDiskConfig returns a platform-specific config file of environmentkeys/values and applies them. On Linux and Unix operating systems, it's ano-op and always returns nil. If no platform-specific config file is found,it also returns nil.
It exists primarily for Windows and macOS to make it easy to applyenvironment variables to a running service in a way similar to modifying/etc/default/tailscaled on Linux.
On Windows, you use %ProgramData%\Tailscale\tailscaled-env.txt instead.
On macOS, use one of:
- /private/var/root/Library/Containers/io.tailscale.ipn.macsys.network-extension/Data/tailscaled-env.txtfor standalone macOS GUI builds
- ~/Library/Containers/io.tailscale.ipn.macos.network-extension/Data/tailscaled-env.txtfor App Store builds
- /etc/tailscale/tailscaled-env.txt for tailscaled-on-macOS (homebrew, etc)
funcApplyDiskConfigError¶added inv1.32.0
func ApplyDiskConfigError()error
ApplyDiskConfigError returns the most recent result of ApplyDiskConfig.
funcBool¶
Bool returns the boolean value of the named environment variable.If the variable is not set, it returns false.An invalid value exits the binary with a failure.
funcBoolDefaultTrue¶
BoolDefaultTrue is like Bool, but returns true by default if theenvironment variable isn't present.
funcCanSSHD¶added inv1.24.0
func CanSSHD()bool
CanSSHD reports whether the Tailscale SSH server is allowed to run.
If disabled (when this reports false), the SSH server won't start (won'tintercept port 22) if previously configured to do so and any attempt tore-enable it will result in an error.
funcCanTaildrop¶added inv1.34.0
func CanTaildrop()bool
CanTaildrop reports whether the Taildrop feature is allowed to function.
If disabled, Taildrop won't receive files regardless of user & server config.
funcCrashOnUnexpected¶added inv1.50.0
func CrashOnUnexpected()bool
CrashOnUnexpected reports whether the Tailscale client should panicon unexpected conditions. If TS_DEBUG_CRASH_ON_UNEXPECTED is set, that'sused. Otherwise the default value is true for unstable builds.
funcGOOS¶added inv1.34.0
func GOOS()string
GOOS reports the effective runtime.GOOS to run as.
In practice this returns just runtime.GOOS, unless overridden bytest TS_DEBUG_FAKE_GOOS.
This allows changing OS-specific stuff like the IPN server behaviorfor tests so we can e.g. test Windows-specific behaviors on Linux.This isn't universally used.
funcIPCVersion¶added inv1.34.0
func IPCVersion()string
IPCVersion returns version.Long usually, unless TS_DEBUG_FAKE_IPC_VERSION isset, in which it contains that value. This is only used for weird developmentcases when testing mismatched versions and you want the client to act like it'scompatible with the server.
funcIsCertShareReadOnlyMode¶added inv1.82.0
func IsCertShareReadOnlyMode()bool
IsCertShareReadOnlyMode returns true if this replica should never attempt toissue or renew TLS credentials for any of the HTTPS endpoints that it isserving. It should only return certs found in its cert store. Currently,this is used by the Kubernetes Operator's HA Ingress via VIPServices, wheremultiple Ingress proxy instances serve the same HTTPS endpoint with a sharedTLS credentials. The TLS credentials should only be issued by one of thereplicas.For HTTPS Ingress the operator and containerboot ensurethat read-only replicas will not be serving the HTTPS endpoints before thereis a shared cert available.
funcIsCertShareReadWriteMode¶added inv1.82.0
func IsCertShareReadWriteMode()bool
IsCertShareReadWriteMode returns true if this instance is the replicaresponsible for issuing and renewing TLS certs in an HA setup with certsshared between multiple replicas.
funcLookupBool¶
LookupBool returns the boolean value of the named environment value.The ok result is whether a value was set.If the value isn't a valid int, it exits the program with a failure.
funcLookupInt¶
LookupInt returns the integer value of the named environment value.The ok result is whether a value was set.If the value isn't a valid int, it exits the program with a failure.
funcLookupIntSized¶added inv1.40.0
LookupIntSized returns the integer value of the named environment valueparsed in base and with a maximum bit size bitSize.The ok result is whether a value was set.If the value isn't a valid int, it exits the program with a failure.
funcLookupUintSized¶added inv1.40.0
LookupUintSized returns the unsigned integer value of the named environmentvalue parsed in base and with a maximum bit size bitSize.The ok result is whether a value was set.If the value isn't a valid int, it exits the program with a failure.
funcNoLogsNoSupport¶added inv1.32.0
func NoLogsNoSupport()bool
NoLogsNoSupport reports whether the client's opted out of log uploads andtechnical support.
funcOptBool¶
OptBool is like Bool, but returns an opt.Bool, so the caller candistinguish between implicitly and explicitly false.
funcPanicIfAnyEnvCheckedInInit¶added inv1.32.0
func PanicIfAnyEnvCheckedInInit()
PanicIfAnyEnvCheckedInInit panics if environment variables were read duringinit.
funcRegisterBool¶added inv1.32.0
RegisterBool returns a func that gets the named environment variable,without a map lookup per call. It assumes that mutations happen viaenvknob.Setenv.
funcRegisterDuration¶added inv1.36.0
RegisterDuration returns a func that gets the named environment variable as aduration, without a map lookup per call. It assumes that any mutations happenvia envknob.Setenv.
funcRegisterInt¶added inv1.38.0
RegisterInt returns a func that gets the named environment variable as aninteger, without a map lookup per call. It assumes that any mutations happenvia envknob.Setenv.
funcRegisterOptBool¶added inv1.32.0
RegisterOptBool returns a func that gets the named environment variable,without a map lookup per call. It assumes that mutations happen viaenvknob.Setenv.
funcRegisterString¶added inv1.32.0
RegisterString returns a func that gets the named environment variable,without a map lookup per call. It assumes that mutations happen viaenvknob.Setenv.
funcSSHIgnoreTailnetPolicy¶added inv1.24.0
func SSHIgnoreTailnetPolicy()bool
SSHIgnoreTailnetPolicy reports whether to ignore the Tailnet SSH policy for development.
funcSSHPolicyFile¶added inv1.24.0
func SSHPolicyFile()string
SSHPolicyFile returns the path, if any, to the SSHPolicy JSON file for development.
funcSetNoLogsNoSupport¶added inv1.32.0
func SetNoLogsNoSupport()
SetNoLogsNoSupport enables no-logs-no-support mode.
funcSetenv¶added inv1.32.0
func Setenv(envVar, valstring)
Setenv changes an environment variable.
It is not safe for concurrent reading of environment variables via theRegister functions. All Setenv calls are meant to happen early in main beforeany goroutines are started.
funcString¶
String returns the named environment variable, using os.Getenv.
If the variable is non-empty, it's also tracked & logged as beingan in-use knob.
funcTKASkipSignatureCheck¶added inv1.32.0
func TKASkipSignatureCheck()bool
TKASkipSignatureCheck reports whether to skip node-key signature checking for development.
funcUseWIPCode¶
func UseWIPCode()bool
UseWIPCode is whether TAILSCALE_USE_WIP_CODE is set to permit useof Work-In-Progress code.
Types¶
This section is empty.
Directories¶
| Path | Synopsis |
|---|---|
Package featureknob provides a facility to control whether features can run based on either an envknob or running OS / distro. | Package featureknob provides a facility to control whether features can run based on either an envknob or running OS / distro. |
Package logknob provides a helpful wrapper that allows enabling logging based on either an envknob or other methods of enablement. | Package logknob provides a helpful wrapper that allows enabling logging based on either an envknob or other methods of enablement. |