updater

package
v0.71.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

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:

  1. Manager receives update directive via SetVersion() or detects new version
  2. Manager validates update should proceed (version comparison, rate limiting)
  3. Manager publishes "updating" event to status recorder
  4. Manager persists UpdateState to track update attempt
  5. Manager downloads installer file (.msi or .exe) to temporary directory
  6. Manager triggers installation via installer.RunInstallation()
  7. Installer package handles the actual installation process
  8. On next startup, CheckUpdateSuccess() verifies update completion
  9. Manager publishes success/failure event to status recorder
  10. 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

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

func (m *Manager) CheckUpdateSuccess(ctx context.Context)

CheckUpdateSuccess checks if the update was successful and send a notification. It works without to start the update manager.

func (*Manager) Install

func (m *Manager) Install(ctx context.Context) error

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

func (m *Manager) SetVersion(expectedVersion string, forceUpdate bool)

func (*Manager) Start

func (m *Manager) Start(ctx context.Context)

func (*Manager) Stop

func (m *Manager) Stop()

Stop is not used at the moment because it fully depends on the daemon. In a future refactor it may make sense to use it.

type UpdateInterface

type UpdateInterface interface {
	StopWatch()
	SetDaemonVersion(newVersion string) bool
	SetOnUpdateListener(updateFn func())
	LatestVersion() *v.Version
	StartFetcher()
}

type UpdateState

type UpdateState struct {
	PreUpdateVersion string
	TargetVersion    string
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL