mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
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>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
d050700a3b
commit
4e91cf20a8
@@ -21,6 +21,7 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"tailscale.com/control/controlknobs"
|
||||
"tailscale.com/ipn"
|
||||
"tailscale.com/net/dns"
|
||||
"tailscale.com/net/netmon"
|
||||
@@ -42,6 +43,7 @@ type System struct {
|
||||
Router SubSystem[router.Router]
|
||||
Tun SubSystem[*tstun.Wrapper]
|
||||
StateStore SubSystem[ipn.StateStore]
|
||||
controlKnobs controlknobs.Knobs
|
||||
}
|
||||
|
||||
// Set is a convenience method to set a subsystem value.
|
||||
@@ -85,6 +87,11 @@ func (s *System) IsNetstack() bool {
|
||||
return name == tstun.FakeTUNName
|
||||
}
|
||||
|
||||
// ControlKnobs returns the control knobs for this node.
|
||||
func (s *System) ControlKnobs() *controlknobs.Knobs {
|
||||
return &s.controlKnobs
|
||||
}
|
||||
|
||||
// SubSystem represents some subsystem of the Tailscale node daemon.
|
||||
//
|
||||
// A subsystem can be set to a value, and then later retrieved. A subsystem
|
||||
|
Reference in New Issue
Block a user