From d594afff389c1cbce67a0a6e03799af7a66e7335 Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Fri, 3 Jul 2026 16:48:05 +0200 Subject: [PATCH] [client] Remove lazy connection UI toggle (#6661) Lazy connections are now opt-out and controlled centrally by NB_LAZY_CONN, MDM policy (lazyConnection), and the management feature flag (#6617). The per-device UI toggle no longer fits this model: after #6617 the daemon stopped persisting the setting and dropped it from GetConfig, so the Wails toggle always read back OFF and its writes did not survive a restart. Remove the toggle and the orphaned runtime plumbing, matching what main did for the Fyne UI: - drop the toggle from SettingsNetwork and the lazy i18n keys - drop LazyConnectionEnabled from the UI settings service and SetConfig request - drop the runtime-apply block in server.SetConfig - delete Engine.SetLazyConnEnabled and ConnMgr.SetLocalLazyConn The proto fields and FullStatus status reporting are left intact. --- client/internal/conn_mgr.go | 36 ------------------- client/internal/engine_lazyconn.go | 19 ---------- client/server/server.go | 10 ------ .../src/modules/settings/SettingsNetwork.tsx | 6 ---- client/ui/i18n/locales/de/common.json | 6 ---- client/ui/i18n/locales/en/common.json | 8 ----- client/ui/i18n/locales/es/common.json | 6 ---- client/ui/i18n/locales/fr/common.json | 6 ---- client/ui/i18n/locales/hu/common.json | 6 ---- client/ui/i18n/locales/it/common.json | 6 ---- client/ui/i18n/locales/pt/common.json | 6 ---- client/ui/i18n/locales/ru/common.json | 6 ---- client/ui/i18n/locales/zh-CN/common.json | 6 ---- client/ui/services/settings.go | 4 --- 14 files changed, 131 deletions(-) delete mode 100644 client/internal/engine_lazyconn.go diff --git a/client/internal/conn_mgr.go b/client/internal/conn_mgr.go index 33b19808c..a82a4ca8b 100644 --- a/client/internal/conn_mgr.go +++ b/client/internal/conn_mgr.go @@ -125,42 +125,6 @@ func (e *ConnMgr) UpdatedRemoteFeatureFlag(ctx context.Context, enabled bool) er } } -// SetLocalLazyConn applies a local lazy connection override (UI / CLI / env). -// While the local override pins the setting (force != lazyForceNone), -// UpdatedRemoteFeatureFlag (management sync) is a no-op, so the local setting -// wins until it is turned off again, which returns control to management. -func (e *ConnMgr) SetLocalLazyConn(ctx context.Context, enabled bool) error { - if enabled { - e.force = lazyForceOn - } else { - e.force = lazyForceNone - } - - if enabled { - if e.lazyConnMgr != nil { - return nil - } - - if e.rosenpassEnabled { - log.Warnf("rosenpass connection manager is enabled, lazy connection manager will not be started") - return nil - } - - log.Infof("lazy connection manager is enabled locally") - e.initLazyManager(ctx) - e.statusRecorder.UpdateLazyConnection(true) - return e.addPeersToLazyConnManager() - } - - if e.lazyConnMgr == nil { - return nil - } - log.Infof("lazy connection manager is disabled locally") - e.closeManager(ctx) - e.statusRecorder.UpdateLazyConnection(false) - return nil -} - // UpdateRouteHAMap updates the route HA mappings in the lazy connection manager func (e *ConnMgr) UpdateRouteHAMap(haMap route.HAMap) { if !e.isStartedWithLazyMgr() { diff --git a/client/internal/engine_lazyconn.go b/client/internal/engine_lazyconn.go deleted file mode 100644 index 4910ccf72..000000000 --- a/client/internal/engine_lazyconn.go +++ /dev/null @@ -1,19 +0,0 @@ -package internal - -import ( - "errors" -) - -// SetLazyConnEnabled applies a local lazy connection override to the running -// engine. It pins the setting like an env/CLI flag, so a later management sync -// cannot override it. syncMsgMux guards ConnMgr, which is not thread-safe. -func (e *Engine) SetLazyConnEnabled(enabled bool) error { - e.syncMsgMux.Lock() - defer e.syncMsgMux.Unlock() - - if e.connMgr == nil { - return errors.New("connection manager is not initialised") - } - - return e.connMgr.SetLocalLazyConn(e.ctx, enabled) -} diff --git a/client/server/server.go b/client/server/server.go index 13489db67..363f716a9 100644 --- a/client/server/server.go +++ b/client/server/server.go @@ -421,16 +421,6 @@ func (s *Server) SetConfig(callerCtx context.Context, msg *proto.SetConfigReques return nil, fmt.Errorf("failed to update profile config: %w", err) } - // Apply the lazy connection toggle to the running engine so it takes - // effect without a down/up. s.mutex is already held. - if msg.LazyConnectionEnabled != nil && s.connectClient != nil { - if engine := s.connectClient.Engine(); engine != nil { - if err := engine.SetLazyConnEnabled(msg.GetLazyConnectionEnabled()); err != nil { - log.Errorf("failed to apply lazy connection change at runtime: %v", err) - } - } - } - return &proto.SetConfigResponse{}, nil } diff --git a/client/ui/frontend/src/modules/settings/SettingsNetwork.tsx b/client/ui/frontend/src/modules/settings/SettingsNetwork.tsx index 32c6f8941..7c903b634 100644 --- a/client/ui/frontend/src/modules/settings/SettingsNetwork.tsx +++ b/client/ui/frontend/src/modules/settings/SettingsNetwork.tsx @@ -12,12 +12,6 @@ export function SettingsNetwork() { return ( <> - setField("lazyConnectionEnabled", v)} - label={t("settings.network.lazy.label")} - helpText={t("settings.network.lazy.help")} - /> setField("networkMonitor", v)} diff --git a/client/ui/i18n/locales/de/common.json b/client/ui/i18n/locales/de/common.json index 82f34ebf3..5e0d8096d 100644 --- a/client/ui/i18n/locales/de/common.json +++ b/client/ui/i18n/locales/de/common.json @@ -599,12 +599,6 @@ "settings.network.section.routingDns": { "message": "Routing & DNS" }, - "settings.network.lazy.label": { - "message": "Lazy-Verbindungen" - }, - "settings.network.lazy.help": { - "message": "Statt durchgehend aktive Verbindungen zu halten, aktiviert NetBird sie bei Bedarf anhand von Aktivität oder Signalisierung." - }, "settings.network.monitor.label": { "message": "Bei Netzwerkwechsel neu verbinden" }, diff --git a/client/ui/i18n/locales/en/common.json b/client/ui/i18n/locales/en/common.json index 1553e7f2f..42d40ec30 100644 --- a/client/ui/i18n/locales/en/common.json +++ b/client/ui/i18n/locales/en/common.json @@ -799,14 +799,6 @@ "message": "Routing & DNS", "description": "Section heading for routing and DNS options. 'DNS' is an acronym — keep it." }, - "settings.network.lazy.label": { - "message": "Lazy Connections", - "description": "Toggle label: Lazy Connections (on-demand connections)." - }, - "settings.network.lazy.help": { - "message": "Instead of maintaining always-on connections, NetBird activates them on-demand based on activity or signaling.", - "description": "Helper text for lazy connections." - }, "settings.network.monitor.label": { "message": "Reconnect on Network Change", "description": "Toggle label: reconnect automatically on network change." diff --git a/client/ui/i18n/locales/es/common.json b/client/ui/i18n/locales/es/common.json index 6276dd7f5..47faee61f 100644 --- a/client/ui/i18n/locales/es/common.json +++ b/client/ui/i18n/locales/es/common.json @@ -599,12 +599,6 @@ "settings.network.section.routingDns": { "message": "Enrutamiento y DNS" }, - "settings.network.lazy.label": { - "message": "Conexiones bajo demanda" - }, - "settings.network.lazy.help": { - "message": "En lugar de mantener conexiones permanentes, NetBird las activa bajo demanda según la actividad o la señalización." - }, "settings.network.monitor.label": { "message": "Reconectar al cambiar de red" }, diff --git a/client/ui/i18n/locales/fr/common.json b/client/ui/i18n/locales/fr/common.json index f51a1ded6..be0836e93 100644 --- a/client/ui/i18n/locales/fr/common.json +++ b/client/ui/i18n/locales/fr/common.json @@ -599,12 +599,6 @@ "settings.network.section.routingDns": { "message": "Routage et DNS" }, - "settings.network.lazy.label": { - "message": "Connexions à la demande" - }, - "settings.network.lazy.help": { - "message": "Au lieu de maintenir des connexions permanentes, NetBird les active à la demande en fonction de l’activité ou de la signalisation." - }, "settings.network.monitor.label": { "message": "Reconnecter en cas de changement de réseau" }, diff --git a/client/ui/i18n/locales/hu/common.json b/client/ui/i18n/locales/hu/common.json index 37dd61d0d..b54918364 100644 --- a/client/ui/i18n/locales/hu/common.json +++ b/client/ui/i18n/locales/hu/common.json @@ -599,12 +599,6 @@ "settings.network.section.routingDns": { "message": "Útválasztás és DNS" }, - "settings.network.lazy.label": { - "message": "Igény szerinti kapcsolatok" - }, - "settings.network.lazy.help": { - "message": "Állandó kapcsolatok fenntartása helyett a NetBird igény szerint, aktivitás vagy jelzés alapján aktiválja azokat." - }, "settings.network.monitor.label": { "message": "Újracsatlakozás hálózatváltáskor" }, diff --git a/client/ui/i18n/locales/it/common.json b/client/ui/i18n/locales/it/common.json index 3224be972..603364fa2 100644 --- a/client/ui/i18n/locales/it/common.json +++ b/client/ui/i18n/locales/it/common.json @@ -599,12 +599,6 @@ "settings.network.section.routingDns": { "message": "Routing e DNS" }, - "settings.network.lazy.label": { - "message": "Connessioni lazy" - }, - "settings.network.lazy.help": { - "message": "Invece di mantenere connessioni sempre attive, NetBird le attiva su richiesta in base all'attività o al signaling." - }, "settings.network.monitor.label": { "message": "Riconnetti al cambio di rete" }, diff --git a/client/ui/i18n/locales/pt/common.json b/client/ui/i18n/locales/pt/common.json index 75b977204..2ed0a94c5 100644 --- a/client/ui/i18n/locales/pt/common.json +++ b/client/ui/i18n/locales/pt/common.json @@ -599,12 +599,6 @@ "settings.network.section.routingDns": { "message": "Roteamento e DNS" }, - "settings.network.lazy.label": { - "message": "Conexões sob demanda" - }, - "settings.network.lazy.help": { - "message": "Em vez de manter conexões sempre ativas, o NetBird as ativa sob demanda com base na atividade ou na sinalização." - }, "settings.network.monitor.label": { "message": "Reconectar ao mudar de rede" }, diff --git a/client/ui/i18n/locales/ru/common.json b/client/ui/i18n/locales/ru/common.json index b9dcc0af7..6ba7de8cc 100644 --- a/client/ui/i18n/locales/ru/common.json +++ b/client/ui/i18n/locales/ru/common.json @@ -599,12 +599,6 @@ "settings.network.section.routingDns": { "message": "Маршрутизация и DNS" }, - "settings.network.lazy.label": { - "message": "Подключения по требованию" - }, - "settings.network.lazy.help": { - "message": "Вместо постоянно активных подключений NetBird активирует их по требованию — на основе активности или сигналинга." - }, "settings.network.monitor.label": { "message": "Переподключаться при смене сети" }, diff --git a/client/ui/i18n/locales/zh-CN/common.json b/client/ui/i18n/locales/zh-CN/common.json index 6c3f8fcda..609344fc0 100644 --- a/client/ui/i18n/locales/zh-CN/common.json +++ b/client/ui/i18n/locales/zh-CN/common.json @@ -599,12 +599,6 @@ "settings.network.section.routingDns": { "message": "路由与 DNS" }, - "settings.network.lazy.label": { - "message": "懒连接" - }, - "settings.network.lazy.help": { - "message": "NetBird 不会维持始终在线的连接,而是根据活动或信令按需激活连接。" - }, "settings.network.monitor.label": { "message": "网络变化时重新连接" }, diff --git a/client/ui/services/settings.go b/client/ui/services/settings.go index 44f1191f8..1c16795ae 100644 --- a/client/ui/services/settings.go +++ b/client/ui/services/settings.go @@ -57,7 +57,6 @@ type Config struct { RosenpassEnabled bool `json:"rosenpassEnabled"` RosenpassPermissive bool `json:"rosenpassPermissive"` DisableNotifications bool `json:"disableNotifications"` - LazyConnectionEnabled bool `json:"lazyConnectionEnabled"` BlockInbound bool `json:"blockInbound"` NetworkMonitor bool `json:"networkMonitor"` DisableClientRoutes bool `json:"disableClientRoutes"` @@ -89,7 +88,6 @@ type SetConfigParams struct { RosenpassEnabled *bool `json:"rosenpassEnabled,omitempty"` RosenpassPermissive *bool `json:"rosenpassPermissive,omitempty"` DisableNotifications *bool `json:"disableNotifications,omitempty"` - LazyConnectionEnabled *bool `json:"lazyConnectionEnabled,omitempty"` BlockInbound *bool `json:"blockInbound,omitempty"` NetworkMonitor *bool `json:"networkMonitor,omitempty"` DisableClientRoutes *bool `json:"disableClientRoutes,omitempty"` @@ -140,7 +138,6 @@ func (s *Settings) GetConfig(ctx context.Context, p ConfigParams) (Config, error RosenpassEnabled: resp.GetRosenpassEnabled(), RosenpassPermissive: resp.GetRosenpassPermissive(), DisableNotifications: resp.GetDisableNotifications(), - LazyConnectionEnabled: resp.GetLazyConnectionEnabled(), BlockInbound: resp.GetBlockInbound(), NetworkMonitor: resp.GetNetworkMonitor(), DisableClientRoutes: resp.GetDisableClientRoutes(), @@ -176,7 +173,6 @@ func (s *Settings) SetConfig(ctx context.Context, p SetConfigParams) error { RosenpassEnabled: p.RosenpassEnabled, RosenpassPermissive: p.RosenpassPermissive, DisableNotifications: p.DisableNotifications, - LazyConnectionEnabled: p.LazyConnectionEnabled, BlockInbound: p.BlockInbound, NetworkMonitor: p.NetworkMonitor, DisableClientRoutes: p.DisableClientRoutes,