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 ¶
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
Click to show internal directories.
Click to hide internal directories.