check

package
v0.3.8-dev-trailers Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2015 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INITIATIVE_NEVER  Initiative = "never"
	INITIATIVE_AUTO              = "auto"
	INITIATIVE_MANUAL            = "manual"
)

Variables

View Source
var NoUpdateAvailable error = fmt.Errorf("No update available")

Functions

This section is empty.

Types

type Initiative

type Initiative string

type Params

type Params struct {
	// protocol version
	Version int `json:"version"`
	// identifier of the application to update
	AppId string `json:"app_id"`
	// version of the application updating itself
	AppVersion string `json:"app_version"`
	// operating system of target platform
	OS string `json:"-"`
	// hardware architecture of target platform
	Arch string `json:"-"`
	// application-level user identifier
	UserId string `json:"user_id"`
	// checksum of the binary to replace (used for returning diff patches)
	Checksum string `json:"checksum"`
	// release channel (empty string means 'stable')
	Channel string `json:"-"`
	// tags for custom update channels
	Tags map[string]string `json:"tags"`
}

func (*Params) CheckAndApplyUpdate

func (p *Params) CheckAndApplyUpdate(url string, up *update.Update) (result *Result, err error, errRecover error)

func (*Params) CheckForUpdate

func (p *Params) CheckForUpdate(url string, up *update.Update) (*Result, error)

CheckForUpdate makes an HTTP post to a URL with the JSON serialized representation of Params. It returns the deserialized result object returned by the remote endpoint or an error. If you do not set OS/Arch, CheckForUpdate will populate them for you. Similarly, if Version is 0, it will be set to 1. Lastly, if Checksum is the empty string, it will be automatically be computed for the running program's executable file.

type Result

type Result struct {

	// should the update be applied automatically/manually
	Initiative Initiative `json:"initiative"`
	// url where to download the updated application
	Url string `json:"url"`
	// a URL to a patch to apply
	PatchUrl string `json:"patch_url"`
	// the patch format (only bsdiff supported at the moment)
	PatchType update.PatchType `json:"patch_type"`
	// version of the new application
	Version string `json:"version"`
	// expected checksum of the new application
	Checksum string `json:"checksum"`
	// signature for verifying update authenticity
	Signature string `json:"signature"`
	// contains filtered or unexported fields
}

func (*Result) Update

func (r *Result) Update() (err error, errRecover error)

Jump to

Keyboard shortcuts

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