wgengine/router{,/osrouter}: split OS router implementations into subpackage

So wgengine/router is just the docs + entrypoint + types, and then
underscore importing wgengine/router/osrouter registers the constructors
with the wgengine/router package.

Then tsnet can not pull those in.

Updates #17313

Change-Id: If313226f6987d709ea9193c8f16a909326ceefe7
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2025-09-27 15:18:25 -07:00
committed by Brad Fitzpatrick
parent 65d6c80695
commit 39e35379d4
29 changed files with 208 additions and 207 deletions
@@ -0,0 +1,13 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
// Code generated by gen.go; DO NOT EDIT.
//go:build ts_omit_osrouter
package buildfeatures
// HasOSRouter is whether the binary was built with support for modular feature "Configure the operating system's network stack, IPs, and routing tables".
// Specifically, it's whether the binary was NOT built with the "ts_omit_osrouter" build tag.
// It's a const so it can be used for dead code elimination.
const HasOSRouter = false
@@ -0,0 +1,13 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
// Code generated by gen.go; DO NOT EDIT.
//go:build !ts_omit_osrouter
package buildfeatures
// HasOSRouter is whether the binary was built with support for modular feature "Configure the operating system's network stack, IPs, and routing tables".
// Specifically, it's whether the binary was NOT built with the "ts_omit_osrouter" build tag.
// It's a const so it can be used for dead code elimination.
const HasOSRouter = true
+8
View File
@@ -0,0 +1,8 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
//go:build !ts_omit_osrouter
package condregister
import _ "tailscale.com/wgengine/router/osrouter"
+10
View File
@@ -126,6 +126,16 @@ var Features = map[FeatureTag]FeatureMeta{
Desc: "Outbound localhost HTTP/SOCK5 proxy support",
Deps: []FeatureTag{"netstack"},
},
"osrouter": {
Sym: "OSRouter",
Desc: "Configure the operating system's network stack, IPs, and routing tables",
// TODO(bradfitz): if this is omitted, and netstack is too, then tailscaled needs
// external config to be useful. Some people may want that, and we should support it,
// but it's rare. Maybe there should be a way to declare here that this "Provides"
// another feature (and netstack can too), and then if those required features provided
// by some other feature are missing, then it's an error by default unless you accept
// that it's okay to proceed without that meta feature.
},
"portlist": {"PortList", "Optionally advertise listening service ports", nil},
"portmapper": {"PortMapper", "NAT-PMP/PCP/UPnP port mapping support", nil},
"netlog": {