mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-30 00:29:48 +00:00
cmd/tailscaled, ipn/localapi, util/eventbus: don't link in regexp when debug is omitted
Saves 442 KB. Lock it with a new min test. Updates #12614 Change-Id: Ia7bf6f797b6cbf08ea65419ade2f359d390f8e91 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
840c7668e2
commit
9386a101d8
@@ -14,12 +14,16 @@ import (
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
"tailscale.com/feature/buildfeatures"
|
||||
"tailscale.com/tsweb"
|
||||
"tailscale.com/types/key"
|
||||
"tailscale.com/util/eventbus"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if !buildfeatures.HasDebugEventBus {
|
||||
log.Fatalf("debug-demo requires the \"debugeventbus\" feature enabled")
|
||||
}
|
||||
b := eventbus.New()
|
||||
c := b.Client("RouteMonitor")
|
||||
go testPub[RouteAdded](c, 5*time.Second)
|
||||
|
||||
@@ -10,8 +10,6 @@ import (
|
||||
"slices"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"tailscale.com/tsweb"
|
||||
)
|
||||
|
||||
// A Debugger offers access to a bus's privileged introspection and
|
||||
@@ -137,8 +135,6 @@ func (d *Debugger) SubscribeTypes(client *Client) []reflect.Type {
|
||||
return client.subscribeTypes()
|
||||
}
|
||||
|
||||
func (d *Debugger) RegisterHTTP(td *tsweb.DebugHandler) { registerHTTPDebugger(d, td) }
|
||||
|
||||
// A hook collects hook functions that can be run as a group.
|
||||
type hook[T any] struct {
|
||||
sync.Mutex
|
||||
|
||||
@@ -29,7 +29,7 @@ type httpDebugger struct {
|
||||
*Debugger
|
||||
}
|
||||
|
||||
func registerHTTPDebugger(d *Debugger, td *tsweb.DebugHandler) {
|
||||
func (d *Debugger) RegisterHTTP(td *tsweb.DebugHandler) {
|
||||
dh := httpDebugger{d}
|
||||
td.Handle("bus", "Event bus", dh)
|
||||
td.HandleSilent("bus/monitor", http.HandlerFunc(dh.serveMonitor))
|
||||
|
||||
@@ -5,14 +5,6 @@
|
||||
|
||||
package eventbus
|
||||
|
||||
func registerHTTPDebugger(d *Debugger, tsWebDebugHandler any) {
|
||||
// The event bus debugging UI uses html/template, which uses
|
||||
// reflection for method lookups. This forces the compiler to
|
||||
// retain a lot more code and information to make dynamic method
|
||||
// dispatch work, which is unacceptable bloat for the iOS build.
|
||||
// We also disable it on Android while we're at it, as nobody
|
||||
// is debugging Tailscale internals on Android.
|
||||
//
|
||||
// TODO: https://github.com/tailscale/tailscale/issues/15297 to
|
||||
// bring the debug UI back to iOS somehow.
|
||||
}
|
||||
type tswebDebugHandler = any // actually *tsweb.DebugHandler; any to avoid import tsweb with ts_omit_debugeventbus
|
||||
|
||||
func (*Debugger) RegisterHTTP(td tswebDebugHandler) {}
|
||||
|
||||
Reference in New Issue
Block a user