updater

package
v0.0.0-...-116ca14 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApplyUpdate = apply_update

* Replace binary

View Source
var ErrorNoUpdateAvailable error = fmt.Errorf("no update available")

Functions

This section is empty.

Types

type CheckParams

type CheckParams struct {
	AppId string `json:"app_id"`
	OS    string `json:"os"`
	Arch  string `json:"arch"`
}

type CheckResult

type CheckResult struct {
	CheckParams
	Url      string `json:"url"`
	Version  string `json:"version"`
	Checksum string `json:"checksum"`
}

type Client

type Client struct {
	Endpoint string
}

func NewClient

func NewClient(endpoint string) *Client

func (*Client) CheckForUpdate

func (c *Client) CheckForUpdate(params CheckParams) (*CheckResult, error)

func (*Client) GetUpdate

func (c *Client) GetUpdate(r *CheckResult) (io.ReadCloser, error)

type Updater

type Updater struct {
	Params CheckParams
	// contains filtered or unexported fields
}

func New

func New(options map[string]string) *Updater

*

  • Basic options to initialize the struct
  • options["version"] = if version is 0, it will be set to 1 (check.go)
  • options["appName"] = identifier of the application to update
  • options["updateUri"] = update server uri

func (*Updater) Check

func (u *Updater) Check() (*CheckResult, error)

func (*Updater) CheckAndUpdate

func (u *Updater) CheckAndUpdate() (bool, error)

* Check for new updates and replace binary

func (*Updater) Update

func (u *Updater) Update(r *CheckResult) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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