upgrade

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoUpdate = errors.New("no update")

Functions

func Apply

func Apply(rq *RequesParam) error

func CommitBinary added in v0.0.10

func CommitBinary(opts Options) error

func Downloader

func Downloader(url string) (io.ReadCloser, error)

func PrepareBinary added in v0.0.10

func PrepareBinary(update io.Reader, opts Options) error

func Restart added in v0.0.7

func Restart() error

func RollbackError added in v0.0.10

func RollbackError(err error) error

Types

type ErrRollback added in v0.0.10

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

type Options added in v0.0.10

type Options struct {
	// TargetPath defines the path to the file to update.
	// The emptry string means 'the executable file of the running program'.
	TargetPath string

	// Create TargetPath replacement with this file mode. If zero, defaults to 0755.
	TargetMode os.FileMode

	// Checksum of the new binary to verify against. If nil, no checksum or signature verification is done.
	Checksum []byte

	// Use this hash function to generate the checksum. If not set, SHA256 is used.
	Hash crypto.Hash
	// contains filtered or unexported fields
}

type RequesParam

type RequesParam struct {
	Server  string `note:"更新服务器"`
	Version string `note:"当前版本"`
}

type UpdateInfo

type UpdateInfo struct {
	Type    string `note:"更新方式"`
	Error   string `note:"错误信息"`
	Message string `note:"提示信息"`
	Release string `note:"更新说明"`
	Version string `note:"最新版本"`
	Package string `note:"下载地址"`
}

func CheckVersion

func CheckVersion(rq *RequesParam) (*UpdateInfo, error)

Jump to

Keyboard shortcuts

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