summaryrefslogtreecommitdiffhomepage
path: root/control/controlknobs/controlknobs.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2023-09-11 12:03:39 -0700
committerBrad Fitzpatrick <brad@danga.com>2023-09-11 12:44:03 -0700
commit4e91cf20a854d19b4c3602a54297fcd23e88e351 (patch)
tree1432d0ac424f6ab6a0f2880e1de784372194e03a /control/controlknobs/controlknobs.go
parentd050700a3bfade74d00b559d07b7656d0fa4adf7 (diff)
downloadtailscale-4e91cf20a854d19b4c3602a54297fcd23e88e351.tar.xz
tailscale-4e91cf20a854d19b4c3602a54297fcd23e88e351.zip
control/controlknobs, all: add plumbed Knobs type, not global variables
Previously two tsnet nodes in the same process couldn't have disjoint sets of controlknob settings from control as both would overwrite each other's global variables. This plumbs a new controlknobs.Knobs type around everywhere and hangs the knobs sent by control on that instead. Updates #9351 Change-Id: I75338646d36813ed971b4ffad6f9a8b41ec91560 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'control/controlknobs/controlknobs.go')
-rw-r--r--control/controlknobs/controlknobs.go34
1 files changed, 21 insertions, 13 deletions
diff --git a/control/controlknobs/controlknobs.go b/control/controlknobs/controlknobs.go
index 65492b39e..ead726e90 100644
--- a/control/controlknobs/controlknobs.go
+++ b/control/controlknobs/controlknobs.go
@@ -8,22 +8,30 @@ package controlknobs
import (
"sync/atomic"
- "tailscale.com/envknob"
+ "tailscale.com/syncs"
+ "tailscale.com/types/opt"
)
-// disableUPnP indicates whether to attempt UPnP mapping.
-var disableUPnPControl atomic.Bool
+// Knobs is the set of knobs that the control plane's coordination server can
+// adjust at runtime.
+type Knobs struct {
+ // DisableUPnP indicates whether to attempt UPnP mapping.
+ DisableUPnP atomic.Bool
-var disableUPnpEnv = envknob.RegisterBool("TS_DISABLE_UPNP")
+ // DisableDRPO is whether control says to disable the
+ // DERP route optimization (Issue 150).
+ DisableDRPO atomic.Bool
-// DisableUPnP reports the last reported value from control
-// whether UPnP portmapping should be disabled.
-func DisableUPnP() bool {
- return disableUPnPControl.Load() || disableUPnpEnv()
-}
+ // KeepFullWGConfig is whether we should disable the lazy wireguard
+ // programming and instead give WireGuard the full netmap always, even for
+ // idle peers.
+ KeepFullWGConfig atomic.Bool
+
+ // RandomizeClientPort is whether control says we should randomize
+ // the client port.
+ RandomizeClientPort atomic.Bool
-// SetDisableUPnP sets whether control says that UPnP should be
-// disabled.
-func SetDisableUPnP(v bool) {
- disableUPnPControl.Store(v)
+ // OneCGNAT is whether the the node should make one big CGNAT route
+ // in the OS rather than one /32 per peer.
+ OneCGNAT syncs.AtomicValue[opt.Bool]
}