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") ErrVersionUnknown = errors.New("couldn't fetch release information") 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-----`)
This 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 LatestGithubReleases ¶
LatestGithubReleases returns the latest releases, including prereleases or not depending on the argument
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.