summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIrbe Krumina <irbe@tailscale.com>2025-01-22 11:13:25 +0200
committerIrbe Krumina <irbe@tailscale.com>2025-01-22 11:39:01 +0200
commita2f0809afe46fff663c9f281b7509e43aa949d6e (patch)
treeae302002e8baaeaf1812e0db6e97a5aea6a5960e
parent042ed6bf693da7061c37bf62b5d823a7b35ae9b5 (diff)
downloadtailscale-irbekrm/funnel_on.tar.xz
tailscale-irbekrm/funnel_on.zip
tailcfg: add a new TailscaleFunnelUsageDetected methodirbekrm/funnel_on
In capver 113 we added new Hostinfo.IngressEnabled field to send to control info if a node has any active funnel endpoint. This is on top of the existing Hostinfo.WireIngress field that sends whether the user intends to use funnel (but it's not neccessarily active). We are now in a state where control will be parsing Hostinfos that can use the new (IngressEnabled) field to more correctly determine if funnel is really enabled as well as Hostinfos that must use the the old Hostinfo.WireIngress field. This PR adds a new TailscaleFunnelUsageDetected method that can be used by control to determine if funnel is enabled for Hostinfos for clients of capver <= 112. Once this merges and changes are made control-side to use this method for <= capver 112 Hostinfos, we can change the currently used TailscaleFunnelEnabled field to use the new Hostinfo.IngressEnabled field. Updates tailscale/tailscale#11572 Updates tailscale/corp#25931 Signed-off-by: Irbe Krumina <irbe@tailscale.com>
-rw-r--r--tailcfg/tailcfg.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/tailcfg/tailcfg.go b/tailcfg/tailcfg.go
index 937f619e6..297fa4e65 100644
--- a/tailcfg/tailcfg.go
+++ b/tailcfg/tailcfg.go
@@ -927,13 +927,24 @@ func (hi *Hostinfo) TailscaleSSHEnabled() bool {
func (v HostinfoView) TailscaleSSHEnabled() bool { return v.ж.TailscaleSSHEnabled() }
-// TailscaleFunnelEnabled reports whether or not this node has explicitly
-// enabled Funnel.
+// TailscaleFunnelEnabled reports whether or not this node has explicitly enabled Funnel.
func (hi *Hostinfo) TailscaleFunnelEnabled() bool {
+ // TODO(irbekrm): once control uses TailscaleFunnelUsageDetected to determine whether funnel is enabled for
+ // clients with capver <= 112, use hi.IngressEnabled here.
return hi != nil && hi.WireIngress
}
-func (v HostinfoView) TailscaleFunnelEnabled() bool { return v.ж.TailscaleFunnelEnabled() }
+// TailscaleFunnelUsageDetected reports whether the node has any funnel config applied to it, including one which
+// contains only disabled endpoints.
+func (hi *Hostinfo) TailscaleFunnelUsageDetected() bool {
+ // TODO(irbekrm): I am adding the hi.IngressEnabled check here so that this method keeps working once we change
+ // the logic to not send Hostinfo.WireIngress when Hostinfo.IngressEnabled is already true. Update this comment
+ // once we make that change.
+ return hi != nil && (hi.WireIngress || hi.IngressEnabled)
+}
+
+func (v HostinfoView) TailscaleFunnelEnabled() bool { return v.ж.TailscaleFunnelEnabled() }
+func (v HostinfoView) TailscaleFunnelUsageDetected() bool { return v.ж.TailscaleFunnelUsageDetected() }
// NetInfo contains information about the host's network state.
type NetInfo struct {