This commit is contained in:
Claire Wang
2024-01-25 16:29:27 -05:00
parent 0f3b2e7b86
commit 1ae16546af
2 changed files with 13 additions and 0 deletions

View File

@@ -73,6 +73,9 @@ type Knobs struct {
// ProbeUDPLifetime is whether the node should probe UDP path lifetime on
// the tail end of an active direct connection in magicsock.
ProbeUDPLifetime atomic.Bool
// SuggestedExitNode is whether the node should be given a suggested exit node.
SuggestedExitNode atomic.Bool
}
// UpdateFromNodeAttributes updates k (if non-nil) based on the provided self
@@ -100,6 +103,7 @@ func (k *Knobs) UpdateFromNodeAttributes(selfNodeAttrs []tailcfg.NodeCapability,
forceNfTables = has(tailcfg.NodeAttrLinuxMustUseNfTables)
seamlessKeyRenewal = has(tailcfg.NodeAttrSeamlessKeyRenewal)
probeUDPLifetime = has(tailcfg.NodeAttrProbeUDPLifetime)
suggestedExitNode = has(tailcfg.NodeAttrSuggestedExitNode)
)
if has(tailcfg.NodeAttrOneCGNATEnable) {
@@ -122,6 +126,7 @@ func (k *Knobs) UpdateFromNodeAttributes(selfNodeAttrs []tailcfg.NodeCapability,
k.LinuxForceNfTables.Store(forceNfTables)
k.SeamlessKeyRenewal.Store(seamlessKeyRenewal)
k.ProbeUDPLifetime.Store(probeUDPLifetime)
k.SuggestedExitNode.Store(suggestedExitNode)
}
// AsDebugJSON returns k as something that can be marshalled with json.Marshal
@@ -145,5 +150,6 @@ func (k *Knobs) AsDebugJSON() map[string]any {
"LinuxForceNfTables": k.LinuxForceNfTables.Load(),
"SeamlessKeyRenewal": k.SeamlessKeyRenewal.Load(),
"ProbeUDPLifetime": k.ProbeUDPLifetime.Load(),
"SuggestedExitNode": k.SuggestedExitNode.Load(),
}
}