updater

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPublicKey = `` /* 9373-byte string literal not displayed */

DefaultPublicKey is the public key used to sign builds.

View Source
const Host = "https://proton.me/download"

Variables

View Source
var (
	ErrDownloadVerify         = errors.New("failed to download or verify the update")
	ErrInstall                = errors.New("failed to install the update")
	ErrUpdateAlreadyInstalled = errors.New("update is already installed")
)
View Source
var DefaultUpdateChannel = StableChannel //nolint:gochecknoglobals

DefaultUpdateChannel is the default update channel to subscribe to. It is set to the stable channel by default, unless overridden at build time.

Functions

func GetDefaultKeyring added in v3.2.0

func GetDefaultKeyring() (*crypto.KeyRing, error)

Types

type Channel

type Channel string

Channel represents an update channel users can be subscribed to.

const (
	// StableChannel is the channel all users are subscribed to by default.
	StableChannel Channel = "stable"

	// EarlyChannel is the channel users subscribe to when they enable "Early Access".
	EarlyChannel Channel = "early"
)

type Downloader

type Downloader interface {
	DownloadAndVerify(ctx context.Context, kr *crypto.KeyRing, url, sig string) ([]byte, error)
}

type Installer

type Installer interface {
	IsAlreadyInstalled(*semver.Version) bool
	InstallUpdate(*semver.Version, io.Reader) error
}

type InstallerDefault

type InstallerDefault struct {
	// contains filtered or unexported fields
}

func NewInstaller

func NewInstaller(versioner *versioner.Versioner) *InstallerDefault

func (*InstallerDefault) InstallUpdate

func (i *InstallerDefault) InstallUpdate(version *semver.Version, r io.Reader) error

func (*InstallerDefault) IsAlreadyInstalled

func (i *InstallerDefault) IsAlreadyInstalled(version *semver.Version) bool

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

func NewUpdater

func NewUpdater(ver *versioner.Versioner, verifier *crypto.KeyRing, product, platform string) *Updater

func (*Updater) GetVersionInfo

func (u *Updater) GetVersionInfo(ctx context.Context, downloader Downloader, channel Channel) (VersionInfo, error)

func (*Updater) InstallUpdate

func (u *Updater) InstallUpdate(ctx context.Context, downloader Downloader, update VersionInfo) error

func (*Updater) RemoveOldUpdates added in v3.7.0

func (u *Updater) RemoveOldUpdates() error

type VersionInfo

type VersionInfo struct {
	// Version is the semantic version of the release.
	Version *semver.Version

	// MinAuto is the earliest version that is able to autoupdate to this version.
	// Apps older than this version must run the manual installer and cannot autoupdate.
	MinAuto *semver.Version

	// Package is the location of the update package.
	Package string

	// Installers are the locations of installer files (for manual installation).
	Installers []string

	// LandingPage is the address of the app landing page on proton.me
	LandingPage string

	// ReleaseNotesPage is the address of the page containing the release notes.
	ReleaseNotesPage string

	// RolloutProportion indicates the proportion (0,1] of users that should update to this version.
	RolloutProportion float64
}

VersionInfo is information about one version of the app.

type VersionMap

type VersionMap map[Channel]VersionInfo

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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