selfupdate

package
v0.0.0-...-5272a8a Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAPIURL     = "https://api.github.com/repos/daoleno/zen/releases?per_page=100"
	ManifestAsset     = "release-manifest.json"
	ManifestSignature = "release-manifest.json.sig"

	CacheTTL            = 24 * time.Hour
	UpdatePublicKeyPKIX = "MCowBQYDK2VwAyEAD+GvALNRsWlmuB8FL5nwWchsLuXI7tasTGYSqkdabzw="
)

Variables

This section is empty.

Functions

func NoticeLine

func NoticeLine(current, latest string) string

func PlatformArtifactName

func PlatformArtifactName(goos, goarch string) (string, error)

func ReplaceExecutable

func ReplaceExecutable(executable string, binary []byte) error

func WriteCache

func WriteCache(path string, cache Cache) error

Types

type Artifact

type Artifact struct {
	Path   string `json:"path"`
	Role   string `json:"role"`
	SHA256 string `json:"sha256"`
	Size   int64  `json:"size"`
	GOOS   string `json:"goos,omitempty"`
	GOARCH string `json:"goarch,omitempty"`
}

type Cache

type Cache struct {
	CheckedAt     time.Time `json:"checked_at"`
	LatestVersion string    `json:"latest_version,omitempty"`
}

func ReadCache

func ReadCache(path string, now time.Time) (Cache, bool)

type Candidate

type Candidate struct {
	Version     string
	Tag         string
	Prerelease  bool
	Artifact    Artifact
	ArtifactURL string
}

type Client

type Client struct {
	HTTPClient *http.Client
	APIURL     string
	PublicKey  ed25519.PublicKey
	GOOS       string
	GOARCH     string
}

func NewClient

func NewClient() (*Client, error)

func (*Client) DownloadBinary

func (c *Client) DownloadBinary(ctx context.Context, candidate Candidate) ([]byte, error)

func (*Client) Latest

func (c *Client) Latest(ctx context.Context, current string) (*Candidate, error)

type Manifest

type Manifest struct {
	SchemaVersion int        `json:"schema_version"`
	Product       string     `json:"product"`
	Version       string     `json:"version"`
	Artifacts     []Artifact `json:"artifacts"`
}

func ParseManifest

func ParseManifest(raw []byte) (Manifest, error)

func VerifyManifest

func VerifyManifest(raw, signature []byte, publicKey ed25519.PublicKey) (Manifest, error)

Jump to

Keyboard shortcuts

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