Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoUpdater ¶
type AutoUpdater struct {
// contains filtered or unexported fields
}
AutoUpdater handles automatic updating.
func NewAutoUpdater ¶
func NewAutoUpdater(options Options) (*AutoUpdater, error)
NewAutoUpdater creates new AutoUpdater and initialize it.
func (*AutoUpdater) Apply ¶
func (a *AutoUpdater) Apply(update io.Reader) error
Apply replaces the software binary with new version, and keep an backup of the old one.
func (*AutoUpdater) Run ¶
func (a *AutoUpdater) Run()
Run starts polling and wait for updates. This method is block. Consider run it in a gorutine.
func (*AutoUpdater) ShutdownChan ¶
func (a *AutoUpdater) ShutdownChan() <-chan struct{}
ShutdownChan Returns a channel to indicate the server should shutdown. This usually happens when the new version is ready.
type Options ¶
type Options struct { // The path of the target to be updated. // If it's left empty, the path of the current executable will be used. // This is mainly for testing purpose. Target string // The base URL for fetch update info. BaseURL string // The architecture (e.g. x86, x86_64) this program runs on. // Will be used for composing the update URL. Architecture string // The platform/os (e.g. linux, darwin) this program runs on. // Will be used for composing the update URL. Platform string CurrentVersion string Interval time.Duration }
Options options to create new AutoUpdater
type VersionInfo ¶
type VersionInfo struct { VersionID string `json:"VersionID"` Tips []string `json:"Tips"` DownloadURL string `json:"DownloadURL"` }
VersionInfo contain information about a version of the software. This must be kept sync with the `DBVersion` struct in the browser repo.
Click to show internal directories.
Click to hide internal directories.