Files
tailscale/feature/buildfeatures/feature_nattraversal_disabled.go
Brad Fitzpatrick fe91043315 wgengine/magicsock, net/netcheck, feature/featuretags: add udptransport and nattraversal features
Contining the trend of making everything be optional that could
possibly be optional, this makes the magicsock UDP underlay transport
be optional. (mostly replacing a bunch of GOOS != "js" checks in the process)

Omitting udptransport (ts_omit_udptransport) makes magicsock DERP-only: no
UDP sockets, no advertised endpoints, and netcheck measures DERP latency
over HTTPS. Omitting only nattraversal keeps disco ping/pong to peers'
advertised endpoints but drops STUN, call-me-maybe, the peer relay client,
the endpoint tracker, and UDP lifetime probing.

Both are plain linker dead-code elimination via buildfeatures
constants. (as oppposed to moving the code all over into feature
packages and indirecting through hooks) The minimal linux/amd64
tailscaled shrinks by 258 KB without nattraversal and 561 KB without
both.

Updates #12614

Change-Id: Ife10804b48a168d9481e4321c18ed8fc85fa71f1
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-09-29 06:09:17 -07:00

14 lines
618 B
Go

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
// Code generated by gen.go; DO NOT EDIT.
//go:build ts_omit_nattraversal
package buildfeatures
// HasNATTraversal is whether the binary was built with support for modular feature "NAT traversal: STUN, disco hole punching, and UDP peer relay client support (if omitted, direct UDP works only to peers with directly reachable endpoints)".
// Specifically, it's whether the binary was NOT built with the "ts_omit_nattraversal" build tag.
// It's a const so it can be used for dead code elimination.
const HasNATTraversal = false