update

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: GPL-3.0 Imports: 11 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 a mihari binary asset for goos/goarch. Expected names include mihari-windows-amd64.exe, mihari-linux-arm64, etc.

type Release

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

Release is a GitHub release document.

type Result

type Result struct {
	Version string
	Updated bool
}

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
}

SelfUpdater installs a newer Mihari binary from GitHub Releases.

func (SelfUpdater) Update

func (u SelfUpdater) Update(ctx context.Context, binaryPath, currentVersion 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