Documentation
¶
Overview ¶
Package update checks for new application releases. It verifies a release manifest signed by the release workflow and decides whether it offers a newer version for the running platform.
Index ¶
Constants ¶
const ( // MaxManifestSize is the largest manifest.json accepted. MaxManifestSize = 64 * 1024 // MaxSignatureSize is the largest manifest.sig accepted. MaxSignatureSize = signing.MaxSignatureSize )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Asset ¶
type Asset struct {
Platform string `json:"platform"`
File string `json:"file"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
Binary Binary `json:"binary"`
}
Asset is one platform's release zip.
type Binary ¶
type Binary struct {
Path string `json:"path"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
}
Binary is the application binary inside a release zip.
type Manifest ¶
type Manifest struct {
Schema int `json:"schema"`
App string `json:"app"`
Version string `json:"version"`
Assets []Asset `json:"assets"`
}
Manifest is a release's update manifest.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is where an application's releases are published: the latest release's manifest and signature file, and the release pages.
func NewSource ¶
NewSource returns the release source for the given URLs. Each must be an absolute HTTPS URL. In releasePageURL, {version} is replaced by the offered version.
func (*Source) FetchLatest ¶
FetchLatest downloads the latest release's manifest and signature file
func (*Source) ReleasePage ¶
ReleasePage returns the URL of the release page for a version. The version must come from a verified manifest, which limits it to MAJOR.MINOR.PATCH.
type Target ¶
Target is the running application a manifest is checked against.
type Version ¶
type Version struct {
Major, Minor, Patch int
}
Version is a release version.
func ParseVersion ¶
ParseVersion parses a release version of exactly the form MAJOR.MINOR.PATCH and reports whether it is one. A leading "v", used by release tags, is not part of a version.
func RunningVersion ¶
RunningVersion parses the running application's version. A version that is not a release version is treated as 0.0.0, so any release is newer.