upgrade

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 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

func CommitBinary(opts *Options) error

func Downloader

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

func PrepareBinary

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

func Restart

func Restart() error

func RollbackError

func RollbackError(err error) error

Types

type ErrRollback

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

type Options

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