server

package
v0.0.0-...-fd97e0e Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2016 License: Apache-2.0, Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrNoSuchAsset       = errors.New(`No such asset with the given checksum`)
	ErrNoUpdateAvailable = errors.New(`No update available`)
)

Public errors

View Source
var Arch = struct {
	X64 string
	X86 string
	ARM string
}{
	"amd64",
	"386",
	"arm",
}

Arch holds architecture names.

View Source
var OS = struct {
	Windows string
	Linux   string
	Darwin  string
}{
	"windows",
	"linux",
	"darwin",
}

OS holds operating system names.

Functions

func SetPrivateKey

func SetPrivateKey(s string)

Types

type Asset

type Asset struct {
	Name      string
	URL       string
	LocalFile string
	Checksum  string
	Signature string
	AssetInfo
	// contains filtered or unexported fields
}

Asset struct represents a file included as part of a Release.

type AssetInfo

type AssetInfo struct {
	OS   string
	Arch string
}

AssetInfo struct holds OS and Arch information of an asset.

type Initiative

type Initiative string

Initiative type.

type Params

type Params struct {
	// protocol version
	Version int `json:"version"`

	// 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"`
}

Params represent parameters sent by the go-update client.

type Patch

type Patch struct {
	File string
	// contains filtered or unexported fields
}

Patch struct is a representation of a patch generated by bsdiff.

type PatchType

type PatchType string

PatchType represents the type of a binary patch, if any. Only bsdiff is supported

const (
	PATCHTYPE_BSDIFF PatchType = "bsdiff"
	PATCHTYPE_NONE             = ""
)

type Release

type Release struct {
	URL     string
	Version semver.Version
	Assets  []Asset
	// contains filtered or unexported fields
}

Release struct represents a single github release.

type ReleaseManager

type ReleaseManager struct {
	// contains filtered or unexported fields
}

ReleaseManager struct defines a repository to pull releases from.

func NewReleaseManager

func NewReleaseManager(owner string, repo string) *ReleaseManager

NewReleaseManager creates a wrapper of github.Client.

func (*ReleaseManager) CheckForUpdate

func (g *ReleaseManager) CheckForUpdate(p *Params) (res *Result, err error)

CheckForUpdate receives a *Params message and emits a *Result. If both res and err are nil it means no update is available.

func (*ReleaseManager) UpdateAssetsMap

func (g *ReleaseManager) UpdateAssetsMap() (err error)

UpdateAssetsMap will pull published releases, scan for compatible update-only binaries and will add them to the updateAssetsMap.

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 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"`
}

Result represents the answer to be sent to the client.

Jump to

Keyboard shortcuts

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