ipn/{ipnext,ipnlocal}: add a SafeBackend interface

Updates #12614

Change-Id: I197e673666e86ea74c19e3935ed71aec269b6c94
Co-authored-by: Nick Khyl <nickk@tailscale.com>
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2025-04-24 13:55:39 -07:00
committed by Brad Fitzpatrick
parent 25c4dc5fd7
commit 3d8533b5d0
8 changed files with 76 additions and 32 deletions
+8 -1
View File
@@ -525,7 +525,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
}
}
if b.extHost, err = NewExtensionHost(logf, sys, b); err != nil {
if b.extHost, err = NewExtensionHost(logf, b); err != nil {
return nil, fmt.Errorf("failed to create extension host: %w", err)
}
b.pm.SetExtensionHost(b.extHost)
@@ -589,6 +589,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
}
func (b *LocalBackend) Clock() tstime.Clock { return b.clock }
func (b *LocalBackend) Sys() *tsd.System { return b.sys }
// FindExtensionByName returns an active extension with the given name,
// or nil if no such extension exists.
@@ -3187,6 +3188,12 @@ func (b *LocalBackend) send(n ipn.Notify) {
b.sendTo(n, allClients)
}
// SendNotify sends a notification to the IPN bus,
// typically to the GUI client.
func (b *LocalBackend) SendNotify(n ipn.Notify) {
b.send(n)
}
// notificationTarget describes a notification recipient.
// A zero value is valid and indicate that the notification
// should be broadcast to all active [watchSession]s.