updater

package
v0.0.0-...-c5aa16e Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Updater

type Updater struct {
	CurrentVersion string // Currently running version.
	APIURL         string // Base URL for API requests (json files).
	CmdName        string // Command name is appended to the ApiURL like http://apiurl/CmdName/. This represents one binary.
	BinURL         string // Base URL for full binary downloads.
	DiffURL        string // Base URL for diff downloads.
	Dir            string // Directory to store selfupdate state.
	Info           struct {
		Version string
		Sha256  []byte
	}
}

Updater is the configuration and runtime data for doing an update.

Note that ApiURL, BinURL and DiffURL should have the same value if all files are available at the same location.

Example:

updater := &selfupdate.Updater{
	CurrentVersion: version,
	ApiURL:         "http://updates.yourdomain.com/",
	BinURL:         "http://updates.yourdownmain.com/",
	DiffURL:        "http://updates.yourdomain.com/",
	Dir:            "update/",
	CmdName:        "myapp", // app name
}
if updater != nil {
	go updater.BackgroundRun()
}

func (*Updater) BackgroundRun

func (u *Updater) BackgroundRun() error

BackgroundRun starts the update check and apply cycle.

Jump to

Keyboard shortcuts

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