updater

package
v1.1.29 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MD5RE = regexp.MustCompile("([0-9a-fA-F]{32})")

regular expression to extract a md5 hash

Functions

func SelfUpdate

func SelfUpdate(baseUrl string) (bool, error)

SelfUpdate downloads the executable and replaces the current running binary baseUrl sample : https://update.domain.com/

Types

type SelfUpdater

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

SelfUpdater allows a binary to update itself

func NewSelfUpdater

func NewSelfUpdater(baseUrl, remoteUrl string) (*SelfUpdater, error)

NewSelfUpdater creates a SelfUpdatr baseUrl sample : https://update.plugis.com/ (must end with /)

func (*SelfUpdater) GetLocalMD5

func (su *SelfUpdater) GetLocalMD5() (string, error)

GetLocalMD5 computes the local md5 of the current binary

func (*SelfUpdater) GetRemoteMD5

func (su *SelfUpdater) GetRemoteMD5() (string, error)

GetRemoteMD5 gets the md5 contained in the remote file with .md5 extension

func (*SelfUpdater) NeedsUpdate

func (su *SelfUpdater) NeedsUpdate() (bool, error)

NeedsUpdate returns true if the md5 of the remote binary is different from the md5 of the local binary

func (*SelfUpdater) SelfUpdate

func (su *SelfUpdater) SelfUpdate(force bool) (bool, error)

SelfUpdate updates the current binary if force==true, don't check md5 and update anyway

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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