updatecheck

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package updatecheck selects update notices from Hikyo's release channel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDownloadHTTPClient

func NewDownloadHTTPClient(timeout time.Duration) (*http.Client, error)

NewDownloadHTTPClient creates a public-address-only client that follows only GitHub's fixed release-asset redirect hosts.

func NewHTTPClient

func NewHTTPClient(timeout time.Duration) (*http.Client, error)

NewHTTPClient creates a no-proxy, public-address-only release client.

Types

type Asset

type Asset struct {
	Name   string `json:"name"`
	URL    string `json:"url"`
	Digest string `json:"digest,omitempty"`
	Size   int64  `json:"size"`
}

Asset is one immutable GitHub release download.

type CachedSource

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

CachedSource bounds release-source requests across all callers in a process.

func NewCachedSource

func NewCachedSource(source Source, ttl time.Duration, now func() time.Time) (*CachedSource, error)

NewCachedSource validates the cache seam before first use.

func (*CachedSource) Releases

func (c *CachedSource) Releases(ctx context.Context) ([]Release, error)

Releases refreshes at most once per TTL. Refresh failures are returned loudly and do not advance freshness; callers may retain their last rendered state, but they cannot mistake stale release data for a successful check.

type Channel

type Channel string

Channel is one installation's release track.

const (
	ChannelStable  Channel = "stable"
	ChannelNightly Channel = "nightly"
	ChannelOff     Channel = "off"
)

func ParseChannel

func ParseChannel(raw string) (Channel, error)

ParseChannel validates a configured release track.

type GitHubSource

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

GitHubSource reads Hikyo's public GitHub Releases feed.

func NewGitHubSource

func NewGitHubSource(client *http.Client) *GitHubSource

NewGitHubSource binds the pinned Hikyo release URL to an HTTP client.

func (*GitHubSource) ReleaseByVersion

func (s *GitHubSource) ReleaseByVersion(ctx context.Context, version string) (Release, error)

ReleaseByVersion resolves an exact authenticated graph reference even after that release has left the first discovery page. The returned record is still discovery only; the caller must verify its signed identity and full inventory.

func (*GitHubSource) Releases

func (s *GitHubSource) Releases(ctx context.Context) ([]Release, error)

Releases returns published records only; drafts never enter a channel.

type Release

type Release struct {
	Version     string    `json:"version"`
	URL         string    `json:"url"`
	Prerelease  bool      `json:"prerelease"`
	Immutable   bool      `json:"immutable"`
	PublishedAt time.Time `json:"published_at"`
	Assets      []Asset   `json:"assets,omitempty"`
}

Release is one published release-source record.

type Source

type Source interface {
	Releases(context.Context) ([]Release, error)
}

Source lists published releases from one fixed release authority.

type Status

type Status struct {
	Channel        Channel   `json:"channel"`
	CurrentVersion string    `json:"current_version"`
	LatestVersion  string    `json:"latest_version,omitempty"`
	URL            string    `json:"url,omitempty"`
	Available      bool      `json:"available"`
	Prerelease     bool      `json:"prerelease"`
	Immutable      bool      `json:"immutable"`
	PublishedAt    time.Time `json:"published_at,omitempty"`
	ApplySupported bool      `json:"apply_supported"`
	ApplyBackend   string    `json:"apply_backend,omitempty"`
	ApplyError     string    `json:"apply_error,omitempty"`
	Assets         []Asset   `json:"-"`
}

Status is the complete notification decision for one installed version.

func Select

func Select(current string, channel Channel, releases []Release) (Status, error)

Select returns the highest published release admitted by channel.

Jump to

Keyboard shortcuts

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