Documentation ¶
Overview ¶
Update protocol:
GET hk.heroku.com/hk/linux-amd64.json 200 ok { "Version": "2", "Sha256": "..." // base64 }
then
GET hkpatch.s3.amazonaws.com/hk/1/2/linux-amd64 200 ok [bsdiff data]
or
GET hkdist.s3.amazonaws.com/hk/2/linux-amd64.gz 200 ok [gzipped executable data]
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHashMismatch = errors.New("new file hash mismatch after patch")
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. Handler func() CheckInterval int // in seconds Verbose bool 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()
BackgroundRun starts the update check and apply cycle.
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/bitbucket.org/kardianos/osext
Extensions to the standard "os" package.
|
Extensions to the standard "os" package. |
_workspace/src/github.com/inconshreveable/go-update
go-update allows a program to update itself by replacing its executable file with a new version.
|
go-update allows a program to update itself by replacing its executable file with a new version. |
_workspace/src/github.com/kr/binarydist
Package binarydist implements binary diff and patch as described on http://www.daemonology.net/bsdiff/.
|
Package binarydist implements binary diff and patch as described on http://www.daemonology.net/bsdiff/. |
Click to show internal directories.
Click to hide internal directories.