upgrade

package
v0.14.48 Latest Latest
Warning

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

Go to latest
Published: May 14, 2018 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package upgrade downloads and compares releases, and upgrades the running binary.

Index

Constants

View Source
const (
	MajorOlder Relation = -2 // Older by a major version (x in x.y.z or 0.x.y).
	Older               = -1 // Older by a minor version (y or z in x.y.z, or y in 0.x.y)
	Equal               = 0  // Versions are semantically equal
	Newer               = 1  // Newer by a minor version (y or z in x.y.z, or y in 0.x.y)
	MajorNewer          = 2  // Newer by a major version (x in x.y.z or 0.x.y).
)
View Source
const DisabledByCompilation = false

Variables

View Source
var (
	ErrVersionUpToDate    = errors.New("current version is up to date")
	ErrNoReleaseDownload  = errors.New("couldn't find a release to download")
	ErrNoVersionToSelect  = errors.New("no version to select")
	ErrUpgradeUnsupported = errors.New("upgrade unsupported")
	ErrUpgradeInProgress  = errors.New("upgrade already in progress")
)
View Source
var SigningKey = []byte(`-----BEGIN EC PUBLIC KEY-----
MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQA1iRk+p+DsmolixxVKcpEVlMDPOeQ
1dWthURMqsjxoJuDAe5I98P/A0kXSdBI7avm5hXhX2opJ5TAyBZLHPpDTRoBg4WN
7jUpeAjtPoVVxvOh37qDeDVcjCgJbbDTPKbjxq/Ae3SHlQMRcoes7lVY1+YJ8dPk
2oPfjA6jtmo9aVbf/uo=
-----END EC PUBLIC KEY-----`)

SigningKey is the public key used to verify signed upgrades. It must match the private key used to sign binaries for the built in upgrade mechanism to accept an upgrade. Keys and signatures can be created and verified with the stsigtool utility. The build script creates signed binaries when given the -sign option.

Functions

func To

func To(rel Release) error

func ToURL

func ToURL(url string) error

Types

type Asset

type Asset struct {
	URL  string `json:"url"`
	Name string `json:"name"`
}

type Relation

type Relation int

func CompareVersions

func CompareVersions(a, b string) Relation

CompareVersions returns a relation describing how a compares to b.

type Release

type Release struct {
	Tag        string  `json:"tag_name"`
	Prerelease bool    `json:"prerelease"`
	Assets     []Asset `json:"assets"`
}

func FetchLatestReleases added in v0.12.5

func FetchLatestReleases(releasesURL, current string) []Release

FetchLatestReleases returns the latest releases. The "current" parameter is used for setting the User-Agent only.

func LatestRelease

func LatestRelease(releasesURL, current string, upgradeToPreReleases bool) (Release, error)

func SelectLatestRelease

func SelectLatestRelease(rels []Release, current string, upgradeToPreReleases bool) (Release, error)

type SortByRelease

type SortByRelease []Release

func (SortByRelease) Len

func (s SortByRelease) Len() int

func (SortByRelease) Less

func (s SortByRelease) Less(i, j int) bool

func (SortByRelease) Swap

func (s SortByRelease) Swap(i, j int)

Jump to

Keyboard shortcuts

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