Documentation
¶
Overview ¶
Package updater provides automatic update management for the NetBird client. It monitors for new versions, handles update triggers from management server directives, and orchestrates the download and installation of client updates.
Overview ¶
The update manager operates as a background service that continuously monitors for available updates and automatically initiates the update process when conditions are met. It integrates with the installer package to perform the actual installation.
Update Flow ¶
The complete update process follows these steps:
- Manager receives update directive via SetVersion() or detects new version
- Manager validates update should proceed (version comparison, rate limiting)
- Manager publishes "updating" event to status recorder
- Manager persists UpdateState to track update attempt
- Manager downloads installer file (.msi or .exe) to temporary directory
- Manager triggers installation via installer.RunInstallation()
- Installer package handles the actual installation process
- On next startup, CheckUpdateSuccess() verifies update completion
- Manager publishes success/failure event to status recorder
- Manager cleans up UpdateState
State Management ¶
Update state is persisted across restarts to track update attempts:
- PreUpdateVersion: Version before update attempt
- TargetVersion: Version attempting to update to
This enables verification of successful updates and appropriate user notification after the client restarts with the new version.
Index ¶
- type Manager
- func (m *Manager) CheckUpdateSuccess(ctx context.Context)
- func (m *Manager) Install(ctx context.Context) error
- func (m *Manager) NotifyUI()
- func (m *Manager) SetDownloadOnly()
- func (m *Manager) SetVersion(expectedVersion string, forceUpdate bool)
- func (m *Manager) Start(ctx context.Context)
- func (m *Manager) Stop()
- type UpdateInterface
- type UpdateState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(statusRecorder *peer.Status, stateManager *statemanager.Manager) *Manager
NewManager creates a new update manager. The manager is single-use: once Stop() is called, it cannot be restarted.
func (*Manager) CheckUpdateSuccess ¶
CheckUpdateSuccess checks if the update was successful and send a notification. It works without to start the update manager.
func (*Manager) Install ¶
Install triggers the installation of the pending version. It is called when the user clicks the install button in the UI.
func (*Manager) NotifyUI ¶
func (m *Manager) NotifyUI()
NotifyUI re-publishes the current update state to a newly connected UI client. Only needed for download-only mode where the latest version is already cached NotifyUI re-publishes the current update state so a newly connected UI gets the info.
func (*Manager) SetDownloadOnly ¶
func (m *Manager) SetDownloadOnly()
func (*Manager) SetVersion ¶
type UpdateInterface ¶
type UpdateState ¶
func (UpdateState) Name ¶
func (u UpdateState) Name() string
Directories
¶
| Path | Synopsis |
|---|---|
|
Package installer provides functionality for managing NetBird application updates and installations across Windows, macOS.
|
Package installer provides functionality for managing NetBird application updates and installations across Windows, macOS. |
|
Package reposign implements a cryptographic signing and verification system for NetBird software update artifacts.
|
Package reposign implements a cryptographic signing and verification system for NetBird software update artifacts. |