updates

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: AGPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAutoUpdateUnsupportedInOfficialContainer = errors.New("auto-update unsupported in official Fossorial container images")

ErrAutoUpdateUnsupportedInOfficialContainer indicates auto-update is not available when running inside official Fossorial container images.

Functions

func CheckAndSelfUpdate added in v1.13.0

func CheckAndSelfUpdate(cfg SelfUpdateConfig) error

CheckAndSelfUpdate contacts the pangolin server, checks whether a newer version of newt is available, downloads it if so, replaces the running binary on disk, and re-executes from the new binary.

It returns an error when the check or update fails. On a successful update the function does not return – the process is replaced by the new binary via syscall.Exec.

func CheckForUpdate

func CheckForUpdate(owner, repo, currentVersion string) error

CheckForUpdate checks the Fossorial versions API for a newer version and prints an update banner if found.

Types

type SelfUpdateConfig added in v1.13.0

type SelfUpdateConfig struct {
	// Endpoint is the base URL of the pangolin server (e.g. "https://app.pangolin.net")
	Endpoint string
	// NewtID is the newt client identifier used for authentication.
	NewtID string
	// Secret is the newt client secret used for authentication.
	Secret string
	// CurrentVersion is the version of the currently running binary.
	CurrentVersion string
	// Platform is the OS+arch string embedded at build time via ldflags
	// (e.g. "linux_amd64", "darwin_arm64").  When non-empty it is used
	// directly; when empty the value is derived from runtime.GOOS/GOARCH.
	Platform string
	// TLSConfig is an optional TLS configuration for the HTTP client (may be nil).
	TLSConfig *tls.Config
}

SelfUpdateConfig holds the configuration required to perform a self-update.

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a semantic version

func (Version) String

func (v Version) String() string

String returns the version as a string

type VersionsAPIEntry added in v1.14.0

type VersionsAPIEntry struct {
	LatestVersion string `json:"latestVersion"`
	ReleaseNotes  string `json:"releaseNotes"`
}

VersionsAPIEntry represents one component's version payload.

type VersionsAPIResponse added in v1.14.0

type VersionsAPIResponse struct {
	Data    map[string]VersionsAPIEntry `json:"data"`
	Success bool                        `json:"success"`
	Error   bool                        `json:"error"`
	Message string                      `json:"message"`
	Status  int                         `json:"status"`
}

VersionsAPIResponse represents the versions API response.

Jump to

Keyboard shortcuts

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