summaryrefslogtreecommitdiffhomepage
path: root/control/controlclient
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2025-09-29 22:10:28 -0700
committerBrad Fitzpatrick <brad@danga.com>2025-09-30 08:25:24 -0700
commitbcd79b161acbf90dfcfe71cbde847a320a41b7fe (patch)
treed9acf006fd800c31a77c56531631f2bbb2b11fa8 /control/controlclient
parenta45473c4c58832073761c4619d1c912e2a49c7fa (diff)
downloadtailscale-bcd79b161acbf90dfcfe71cbde847a320a41b7fe.tar.xz
tailscale-bcd79b161acbf90dfcfe71cbde847a320a41b7fe.zip
feature/featuretags: add option to turn off DNS
Saves 328 KB (2.5%) off the minimal binary. For IoT devices that don't need MagicDNS (e.g. they don't make outbound connections), this provides a knob to disable all the DNS functionality. Rather than a massive refactor today, this uses constant false values as a deadcode sledgehammer, guided by shotizam to find the largest DNS functions which survived deadcode. A future refactor could make it so that the net/dns/resolver and publicdns packages don't even show up in the import graph (along with their imports) but really it's already pretty good looking with just these consts, so it's not at the top of my list to refactor it more soon. Also do the same in a few places with the ACME (cert) functionality, as I saw those while searching for DNS stuff. Updates #12614 Change-Id: I8e459f595c2fde68ca16503ff61c8ab339871f97 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'control/controlclient')
-rw-r--r--control/controlclient/direct.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go
index 6d18e306f..31f41eac8 100644
--- a/control/controlclient/direct.go
+++ b/control/controlclient/direct.go
@@ -30,6 +30,7 @@ import (
"tailscale.com/control/controlknobs"
"tailscale.com/envknob"
"tailscale.com/feature"
+ "tailscale.com/feature/buildfeatures"
"tailscale.com/health"
"tailscale.com/hostinfo"
"tailscale.com/ipn/ipnstate"
@@ -1580,6 +1581,9 @@ func (c *Direct) setDNSNoise(ctx context.Context, req *tailcfg.SetDNSRequest) er
// SetDNS sends the SetDNSRequest request to the control plane server,
// requesting a DNS record be created or updated.
func (c *Direct) SetDNS(ctx context.Context, req *tailcfg.SetDNSRequest) (err error) {
+ if !buildfeatures.HasACME {
+ return feature.ErrUnavailable
+ }
metricSetDNS.Add(1)
defer func() {
if err != nil {