updater

package
v3.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: GPL-3.0 Imports: 18 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")
	ErrVersionFileDownloadOrVerify = errors.New("failed to download or verify the version file")
	ErrReleaseUpdatePackageMissing = errors.New("release update package is missing")
)
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 File added in v3.18.0

type File struct {
	URL            string         `json:"Url"`
	Sha512CheckSum string         `json:"Sha512CheckSum,omitempty"`
	Identifier     FileIdentifier `json:"Identifier"`
}

type FileIdentifier added in v3.18.0

type FileIdentifier uint8
const (
	PackageIdentifier FileIdentifier = iota
	InstallerIdentifier
)

func ParseFileIdentifier added in v3.18.0

func ParseFileIdentifier(s string) (FileIdentifier, error)

func (FileIdentifier) MarshalJSON added in v3.18.0

func (fi FileIdentifier) MarshalJSON() ([]byte, error)

func (FileIdentifier) String added in v3.18.0

func (fi FileIdentifier) String() string

func (*FileIdentifier) UnmarshalJSON added in v3.18.0

func (fi *FileIdentifier) UnmarshalJSON(data []byte) (err 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 Release added in v3.18.0

type Release struct {
	ReleaseCategory   ReleaseCategory `json:"CategoryName"`
	Version           *semver.Version
	SystemVersion     versioncompare.SystemVersion `json:"SystemVersion,omitempty"`
	RolloutProportion float64
	MinAuto           *semver.Version `json:"MinAuto,omitempty"`
	ReleaseNotesPage  string
	LandingPage       string
	File              []File `json:"File"`
}

func (Release) IsEmpty added in v3.18.0

func (rel Release) IsEmpty() bool

type ReleaseCategory added in v3.18.0

type ReleaseCategory uint8
const (
	EarlyAccessReleaseCategory ReleaseCategory = iota
	StableReleaseCategory
)

func ParseReleaseCategory added in v3.18.0

func ParseReleaseCategory(s string) (ReleaseCategory, error)

func (ReleaseCategory) MarshalJSON added in v3.18.0

func (rc ReleaseCategory) MarshalJSON() ([]byte, error)

func (ReleaseCategory) String added in v3.18.0

func (rc ReleaseCategory) String() string

func (*ReleaseCategory) UnmarshalJSON added in v3.18.0

func (rc *ReleaseCategory) UnmarshalJSON(data []byte) (err error)

func (ReleaseCategory) UpdateEligible added in v3.18.0

func (rc ReleaseCategory) UpdateEligible(channel Channel) 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) (VersionInfo, error)

func (*Updater) GetVersionInfoLegacy added in v3.18.0

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

func (*Updater) InstallUpdate

func (u *Updater) InstallUpdate(ctx context.Context, downloader Downloader, release Release) error

func (*Updater) InstallUpdateLegacy added in v3.18.0

func (u *Updater) InstallUpdateLegacy(ctx context.Context, downloader Downloader, update VersionInfoLegacy) error

func (*Updater) RemoveOldUpdates added in v3.7.0

func (u *Updater) RemoveOldUpdates() error

type VersionInfo

type VersionInfo struct {
	Releases []Release `json:"Releases"`
}

type VersionInfoLegacy added in v3.18.0

type VersionInfoLegacy 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
}

VersionInfoLegacy is information about one version of the app.

func (VersionInfoLegacy) IsEmpty added in v3.18.0

func (verInfo VersionInfoLegacy) IsEmpty() bool

type VersionMap

type VersionMap map[Channel]VersionInfoLegacy

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