mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 02:31:18 -08:00
LocalBackend named appc.AppConnector in its appConnector field, in the field's constructor call, and in the AppConnector accessor, so even builds with ts_omit_appconnectors linked the appc package and its dependencies. The buildfeatures.HasAppConnectors checks let the linker drop the code but could not remove the import. Add a build-tag-gated type for the field: appcAppConnector is an alias for appc.AppConnector by default, and in ts_omit_appconnectors builds it is an empty struct with no-op versions of the methods local.go calls, so the shared code still type checks. The constructor call moves behind a newAppConnector helper in the same gated file, and the AppConnector accessor keeps its *appc.AppConnector signature there, with a nil- returning version in the omitted build. This takes tailscale.com/appc out of depaware-min.txt and depaware-minbox.txt. Add a DepChecker test to keep it out; it also sets ts_omit_conn25, since conn25 uses appc as well. Updates #12614 Signed-off-by: Brad Fitzpatrick <[email protected]> Change-Id: Ia7e2d9c4f1b8e6a3d5c0f2b7e9a1c4d6f8b0e2a5
36 lines
1.5 KiB
Go
36 lines
1.5 KiB
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build ts_omit_appconnectors
|
|
|
|
package ipnlocal
|
|
|
|
import (
|
|
"net/netip"
|
|
|
|
"tailscale.com/types/appctype"
|
|
"tailscale.com/types/logger"
|
|
"tailscale.com/util/eventbus"
|
|
)
|
|
|
|
// appcAppConnector stands in for [tailscale.com/appc.AppConnector] in
|
|
// builds without app connectors, so that this package does not import
|
|
// appc. Its methods exist only so that the shared code in local.go type
|
|
// checks; they are never reached, because every caller first checks
|
|
// [buildfeatures.HasAppConnectors] and b.appConnector is always nil.
|
|
type appcAppConnector struct{}
|
|
|
|
func newAppConnector(logf logger.Logf, bus *eventbus.Bus, ri *appctype.RouteInfo, storeRoutes bool) *appcAppConnector {
|
|
panic("unreachable with ts_omit_appconnectors")
|
|
}
|
|
|
|
func (*appcAppConnector) Close() {}
|
|
func (*appcAppConnector) ShouldStoreRoutes() bool { return false }
|
|
func (*appcAppConnector) UpdateDomainsAndRoutes(domains []string, routes []netip.Prefix) {}
|
|
func (*appcAppConnector) DomainRoutes() map[string][]netip.Addr { return nil }
|
|
func (*appcAppConnector) ObserveDNSResponse(res []byte) error { return nil }
|
|
func (*appcAppConnector) ClearRoutes() error { return nil }
|
|
|
|
// AppConnector returns nil; app connectors are omitted from this build.
|
|
func (b *LocalBackend) AppConnector() *appcAppConnector { return nil }
|