mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-29 19:11:28 +02:00
[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.
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,6 @@ export function SettingsNetwork() {
|
||||
return (
|
||||
<>
|
||||
<SectionGroup title={t("settings.network.section.connectivity")}>
|
||||
<FancyToggleSwitch
|
||||
value={config.lazyConnectionEnabled}
|
||||
onChange={(v) => setField("lazyConnectionEnabled", v)}
|
||||
label={t("settings.network.lazy.label")}
|
||||
helpText={t("settings.network.lazy.help")}
|
||||
/>
|
||||
<FancyToggleSwitch
|
||||
value={config.networkMonitor}
|
||||
onChange={(v) => setField("networkMonitor", v)}
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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": "Переподключаться при смене сети"
|
||||
},
|
||||
|
||||
@@ -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": "网络变化时重新连接"
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user