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 ¶
Types ¶
type Relation ¶
type Relation int
func CompareVersions ¶
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
FetchLatestReleases returns the latest releases. The "current" parameter is used for setting the User-Agent only.
func LatestRelease ¶
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)
Click to show internal directories.
Click to hide internal directories.