Movatterモバイル変換


[0]ホーム

URL:


envknob

package
v1.92.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:20Imported by:132

Details

Repository

github.com/tailscale/tailscale

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

Constants

This section is empty.

Variables

This section is empty.

Functions

funcAllowsRemoteUpdateadded 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).

funcAppadded 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.

funcApplyDiskConfigadded 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)

funcApplyDiskConfigErroradded inv1.32.0

func ApplyDiskConfigError()error

ApplyDiskConfigError returns the most recent result of ApplyDiskConfig.

funcBool

func Bool(envVarstring)bool

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

func BoolDefaultTrue(envVarstring)bool

BoolDefaultTrue is like Bool, but returns true by default if theenvironment variable isn't present.

funcCanSSHDadded 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.

funcCanTaildropadded 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.

funcCrashOnUnexpectedadded 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.

funcGOOSadded 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.

funcIPCVersionadded 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.

funcIsCertShareReadOnlyModeadded 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.

funcIsCertShareReadWriteModeadded 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.

funcLogCurrent

func LogCurrent(logf logf)

LogCurrent logs the currently set environment knobs.

funcLookupBool

func LookupBool(envVarstring) (vbool, okbool)

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

func LookupInt(envVarstring) (vint, okbool)

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.

funcLookupIntSizedadded inv1.40.0

func LookupIntSized(envVarstring, base, bitSizeint) (vint, okbool)

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.

funcLookupUintSizedadded inv1.40.0

func LookupUintSized(envVarstring, base, bitSizeint) (vuint, okbool)

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.

funcNoLogsNoSupportadded inv1.32.0

func NoLogsNoSupport()bool

NoLogsNoSupport reports whether the client's opted out of log uploads andtechnical support.

funcOptBool

func OptBool(envVarstring)opt.Bool

OptBool is like Bool, but returns an opt.Bool, so the caller candistinguish between implicitly and explicitly false.

funcPanicIfAnyEnvCheckedInInitadded inv1.32.0

func PanicIfAnyEnvCheckedInInit()

PanicIfAnyEnvCheckedInInit panics if environment variables were read duringinit.

funcRegisterBooladded inv1.32.0

func RegisterBool(envVarstring) func()bool

RegisterBool returns a func that gets the named environment variable,without a map lookup per call. It assumes that mutations happen viaenvknob.Setenv.

funcRegisterDurationadded inv1.36.0

func RegisterDuration(envVarstring) func()time.Duration

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.

funcRegisterIntadded inv1.38.0

func RegisterInt(envVarstring) func()int

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.

funcRegisterOptBooladded inv1.32.0

func RegisterOptBool(envVarstring) func()opt.Bool

RegisterOptBool returns a func that gets the named environment variable,without a map lookup per call. It assumes that mutations happen viaenvknob.Setenv.

funcRegisterStringadded inv1.32.0

func RegisterString(envVarstring) func()string

RegisterString returns a func that gets the named environment variable,without a map lookup per call. It assumes that mutations happen viaenvknob.Setenv.

funcSSHIgnoreTailnetPolicyadded inv1.24.0

func SSHIgnoreTailnetPolicy()bool

SSHIgnoreTailnetPolicy reports whether to ignore the Tailnet SSH policy for development.

funcSSHPolicyFileadded inv1.24.0

func SSHPolicyFile()string

SSHPolicyFile returns the path, if any, to the SSHPolicy JSON file for development.

funcSetNoLogsNoSupportadded inv1.32.0

func SetNoLogsNoSupport()

SetNoLogsNoSupport enables no-logs-no-support mode.

funcSetenvadded 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

func String(envVarstring)string

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.

funcTKASkipSignatureCheckadded 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.

Source Files

View all Source files

Directories

PathSynopsis
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp