updater

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyChecksum

func VerifyChecksum(archivePath, archiveName, checksumsPath string) error

VerifyChecksum checks the SHA256 of archivePath against the checksums file.

Types

type Config

type Config struct {
	CheckInterval time.Duration
	Repo          string // "owner/repo"
	InstallDir    string
	Version       string // updater's own version (used for user-agent)
}

Config holds the updater configuration.

type GitHubAsset

type GitHubAsset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

GitHubAsset represents a release asset.

type GitHubRelease

type GitHubRelease struct {
	TagName string        `json:"tag_name"`
	Assets  []GitHubAsset `json:"assets"`
}

GitHubRelease represents a subset of the GitHub release API response.

type Semver

type Semver struct {
	Major int
	Minor int
	Patch int
}

Semver represents a parsed semantic version.

func ParseSemver

func ParseSemver(s string) (Semver, error)

ParseSemver parses a version string like "v1.2.3" or "1.2.3" or "v1.2.3-dirty". It strips the "v" prefix and any suffix after a hyphen.

func (Semver) NewerThan

func (v Semver) NewerThan(other Semver) bool

NewerThan returns true if v is strictly newer than other.

func (Semver) String

func (v Semver) String() string

String returns the version as "vMAJOR.MINOR.PATCH".

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater periodically checks GitHub Releases for new versions and optionally applies them.

func New

func New(cfg Config) *Updater

New creates a new Updater.

func (*Updater) Start

func (u *Updater) Start()

Start begins the periodic check loop.

func (*Updater) Stop

func (u *Updater) Stop()

Stop signals the check loop to stop and waits for it to finish.

Jump to

Keyboard shortcuts

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