Documentation
¶
Overview ¶
Package update implements the self-update flow: discover the newest GitHub release, compare it to the running version, and swap the executable for the freshly downloaded (checksum-verified) release binary. Checks are throttled through a small cache file so startup never spams the network.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetName ¶
AssetName is the release archive for this OS/arch, e.g. sleeperagent_0.5.0_darwin_arm64.tar.gz (zip on Windows).
func CleanupOld ¶
func CleanupOld()
CleanupOld removes the "<exe>.old" left behind by a Windows self-update. Best-effort: it fails silently while an old instance still runs.
func Newer ¶
Newer reports whether latest is strictly newer than current. Unparseable versions (e.g. a "dev" source build) are never considered outdated.
func Parseable ¶
Parseable reports whether v looks like a release version ("0.5.0", "v0.5.0"). Source builds report "dev" (or a pseudo-version) and can't be meaningfully compared to releases.
func RecordCheck ¶
func RecordCheck(latest string)
RecordCheck persists the result (or attempt) of an update check so the next startup within maxAge skips the network entirely.
func ShouldCheck ¶
ShouldCheck reports whether the last check is older than maxAge. A missing or unreadable cache means "check now".
Types ¶
type Client ¶
Client talks to the release host. BaseURL is normally https://github.com; SLEEPERAGENT_UPDATE_BASE_URL overrides it (tests, mirrors).
func (*Client) Apply ¶
Apply downloads the given release, verifies it against checksums.txt, and replaces the running executable. The running process keeps executing the old code; the new version takes effect on the next start.