go-selfupdate

module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT

README

go-selfupdate

GoDoc Build Status

Enable your Golang applications to self update. Inspired by Chrome based on Heroku's hk.

Features

  • Tested on Mac, Linux, Arm, and Windows
  • Creates binary diffs with bsdiff allowing small incremental updates
  • Falls back to full binary update if diff fails to match SHA

QuickStart

Install library and update/patch creation utility

go get -u github.com/sanbornm/go-selfupdate/...

Enable your App to Self Update
var updater = &selfupdate.Updater{
	CurrentVersion: version,
	ApiURL:         "http://updates.yourdomain.com/",
	BinURL:         "http://updates.yourdomain.com/",
	DiffURL:        "http://updates.yourdomain.com/",
	LocalStateDir:  "update/",
	AppName:        "myApp",
	DirName:        "cli", // direcroty name
}

if updater != nil {
	go updater.BackgroundRun()
}

Directories

Path Synopsis
cmd
example
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]
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]

Jump to

Keyboard shortcuts

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