update

package
v0.9.0-dev.11 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: GPL-3.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package update downloads and replaces the Mihari binary (self-update).

Index

Constants

View Source
const (
	// ChannelMain tracks official GitHub latest releases.
	ChannelMain = "main"
	// ChannelDev tracks canonical prerelease tags vX.Y.Z-dev.N.
	ChannelDev = "dev"
)

Variables

This section is empty.

Functions

func LoadChannel added in v0.9.0

func LoadChannel(path string) (string, error)

LoadChannel reads the Mihari release channel from path. A missing file defaults to ChannelMain. An invalid first line is an error.

func SaveChannel added in v0.9.0

func SaveChannel(path, channel string) error

SaveChannel atomically writes channel to path. Only main and dev are accepted.

Types

type Asset

type Asset struct {
	Name string `json:"name"`
	URL  string `json:"browser_download_url"`
	Size int64  `json:"size"`
}

Asset is a GitHub release asset.

func SelectSelfAsset

func SelectSelfAsset(release Release, goos, goarch string) (Asset, error)

SelectSelfAsset picks the unique mihari binary asset for goos/goarch. Expected names are mihari-windows-<arch>.exe or mihari-<goos>-<arch>.

type CheckResult added in v0.4.0

type CheckResult struct {
	Current   string
	Latest    string
	Available bool
	Ahead     bool
	Channel   string
}

CheckResult describes the latest Mihari release relative to the running version.

type Release

type Release struct {
	TagName string  `json:"tag_name"`
	Draft   bool    `json:"draft"`
	Assets  []Asset `json:"assets"`
}

Release is a GitHub release document.

type Result

type Result struct {
	Version string
	Updated bool
	Ahead   bool
	Channel string
}

Result describes a self-update attempt.

type SelfUpdater

type SelfUpdater struct {
	HTTPClient *http.Client
	APIBase    string
	Repository string
	GOOS       string
	GOARCH     string
	// AfterReplace is optional; used to restart the OS service after a successful replace.
	AfterReplace func(ctx context.Context, version string) error
	// contains filtered or unexported fields
}

SelfUpdater installs a newer Mihari binary from GitHub Releases.

func (SelfUpdater) Check added in v0.4.0

func (u SelfUpdater) Check(ctx context.Context, currentVersion, channel string) (CheckResult, error)

Check reports whether GitHub Releases contains a newer Mihari version for channel.

func (SelfUpdater) Update

func (u SelfUpdater) Update(ctx context.Context, binaryPath, currentVersion, channel string) (Result, error)

Update downloads the latest release when newer than currentVersion and replaces binaryPath.

Jump to

Keyboard shortcuts

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