updater

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package updater is SSHYard's update client. Releases are published as MyGo publishes them on GitHub Releases: a signed archive per platform with a manifest, update-<os>-<arch>.json, in the latest release of Licoy/sshyard. Installing goes through mygo.Updater, which checks the Ed25519 signature against the public key built into the app.

Index

Constants

View Source
const MaxManifestSize = 1 << 20

MaxManifestSize bounds a manifest read from the network.

View Source
const Repo = "Licoy/sshyard"

Repo is the GitHub repository SSHYard's releases are published in.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b string) int

Compare compares two version strings; an unparsable one sorts first.

func ManifestName

func ManifestName(goos, goarch string) string

ManifestName is the manifest's file name for a platform.

func ManifestURL

func ManifestURL(repo, goos, goarch string) string

ManifestURL is where the latest release's manifest of a platform is.

func Plugin

func Plugin(interval time.Duration, automatic bool) mygo.Plugin

Plugin is MyGo's updater plugin drawn in native UI, which reads the manifest `mygo build` publishes to the latest release of the repository in mygo.json (updates.github = Licoy/sshyard) and verifies signatures. It checks soon after each launch and every interval after while automatic is on. The interval is read once: a change applies at the next launch.

Types

type Backend

type Backend interface {
	// Enabled reports whether this build can update itself: development
	// builds and those installed by a package manager cannot.
	Enabled() bool
	// Check checks as the user asked: the update window shows at once and
	// says what it found.
	Check()
	// SetAutomatic turns the checks in the background on or off.
	SetAutomatic(on bool)
	// Available is the newer version the last check found, or "".
	Available() string
	// OnChange calls fn on the main thread after Available may have
	// changed, and returns a function that removes it.
	OnChange(fn func()) (off func())
}

Backend is the update window of the app: MyGo's updater plugin, which checks soon after launch and every interval after, shows the release notes of a newer version in its own window and installs it; a fake in tests.

type Delta

type Delta struct {
	From      string `json:"from"`
	URL       string `json:"url"`
	Size      int64  `json:"size"`
	Signature string `json:"signature"`
}

Delta is a delta update from an earlier version.

type Manifest

type Manifest struct {
	Version   string  `json:"version"`
	Notes     string  `json:"notes,omitempty"`
	Date      string  `json:"date,omitempty"`
	URL       string  `json:"url"`
	Size      int64   `json:"size"`
	Signature string  `json:"signature"`
	Deltas    []Delta `json:"deltas,omitempty"`
}

Manifest is MyGo's update manifest, update-<os>-<arch>.json.

func ParseManifest

func ParseManifest(r io.Reader) (*Manifest, error)

ParseManifest reads and checks a manifest.

func (*Manifest) Newer

func (m *Manifest) Newer(current string) bool

Newer reports whether the manifest offers a version newer than current.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate checks that the manifest is complete and safe to follow.

type MygoBackend

type MygoBackend struct{}

MygoBackend is the Backend of the app, over the plugin Plugin returns, which must be used.

func (MygoBackend) Available

func (MygoBackend) Available() string

func (MygoBackend) Check

func (MygoBackend) Check()

func (MygoBackend) Enabled

func (MygoBackend) Enabled() bool

func (MygoBackend) OnChange

func (MygoBackend) OnChange(fn func()) (off func())

func (MygoBackend) SetAutomatic

func (MygoBackend) SetAutomatic(on bool)

type Version

type Version struct {
	Major, Minor, Patch int
	Pre                 []string
}

Version is a semantic version: major.minor.patch with an optional prerelease; build metadata is ignored.

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion parses "1.2.3", "v1.2.3-beta.1" or "1.2.3+build".

func (Version) Compare

func (v Version) Compare(o Version) int

Compare orders versions by semver precedence: -1, 0 or 1.

func (Version) Prerelease

func (v Version) Prerelease() bool

Prerelease reports whether the version is a prerelease.

func (Version) String

func (v Version) String() string

String formats the version without a "v".

Jump to

Keyboard shortcuts

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