summaryrefslogtreecommitdiffhomepage
path: root/ipn/ipnlocal/extension_host.go
diff options
context:
space:
mode:
Diffstat (limited to 'ipn/ipnlocal/extension_host.go')
-rw-r--r--ipn/ipnlocal/extension_host.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/ipn/ipnlocal/extension_host.go b/ipn/ipnlocal/extension_host.go
index 125a23294..9498b78c2 100644
--- a/ipn/ipnlocal/extension_host.go
+++ b/ipn/ipnlocal/extension_host.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"maps"
+ "net/netip"
"reflect"
"slices"
"strings"
@@ -124,6 +125,9 @@ type Backend interface {
NodeBackend() ipnext.NodeBackend
+ AdvertiseRoute(routes ...netip.Prefix) error
+ UnadvertiseRoute(routes ...netip.Prefix) error
+
ipnext.SafeBackend
}
@@ -401,6 +405,30 @@ func (h *ExtensionHost) SendNotifyAsync(n ipn.Notify) {
})
}
+// AdvertiseRoutesAsync implements [ipnext.Host].
+func (h *ExtensionHost) AdvertiseRoutesAsync(routes []netip.Prefix) {
+ if h == nil || len(routes) == 0 {
+ return
+ }
+ h.enqueueBackendOperation(func(b Backend) {
+ if err := b.AdvertiseRoute(routes...); err != nil {
+ h.logf("failed to advertise routes: %v", err)
+ }
+ })
+}
+
+// UnadvertiseRoutesAsync implements [ipnext.Host].
+func (h *ExtensionHost) UnadvertiseRoutesAsync(routes []netip.Prefix) {
+ if h == nil || len(routes) == 0 {
+ return
+ }
+ h.enqueueBackendOperation(func(b Backend) {
+ if err := b.UnadvertiseRoute(routes...); err != nil {
+ h.logf("failed to unadvertise routes: %v", err)
+ }
+ })
+}
+
// NotifyProfileChange invokes registered profile state change callbacks
// and updates the current profile and prefs in the host.
// It strips private keys from the [ipn.Prefs] before preserving