upgrade

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MIT Imports: 13 Imported by: 0

README

update

update update.exe
package main
import "github.com/gotask/gost/upgrade"

func main() {
    upgrade.Update()
}

server

server server.exe
package main
import "github.com/gotask/gost/upgrade"
import "github.com/gotask/gost/stutil"

func main() {
	stutil.SysDaemon()
    upgrade.StartServer("127.0.0.1:1111")
    upgrade.WaitStopSignal(func() {
        //onclosse
    })
}

client

linuxapp.v1 linuxapp.v3 winapp.exe.v1 winapp.v2
package main
import "github.com/gotask/gost/upgrade"
import "github.com/gotask/gost/stutil"

func main() {
    stutil.SysDaemon()
    
    upgrade.StartClient("127.0.0.1:1111", 0)  //start version 0
    upgrade.WaitStopSignal(func() {
		//onclosse
	})
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LOG = stlog.NewFileLoggerWithoutTerm("update.log")
)

Functions

func StartClient

func StartClient(remote string, ver uint32) error

func StartServer

func StartServer(address string) error

func Update

func Update()

func WaitStopSignal

func WaitStopSignal(oc OnClose)

Types

type FileContent

type FileContent struct {
	Name    string
	Version uint32
	Index   uint64
	Total   uint64
	Content []byte
	Err     string
}

type FileVersion

type FileVersion struct {
	Name    string
	Version uint32
}

type OnAppCloseAndUpdate

type OnAppCloseAndUpdate func() error

type OnClose

type OnClose func()

type UpgradeServer

type UpgradeServer struct {
}

func (*UpgradeServer) GetLastedVersion

func (s *UpgradeServer) GetLastedVersion(name string) uint32

rpc functions

func (*UpgradeServer) HandleError

func (s *UpgradeServer) HandleError(current *stnet.CurrentContent, err error)

func (*UpgradeServer) HandleReq

func (s *UpgradeServer) HandleReq(current *stnet.CurrentContent, msg *stnet.ReqProto)

func (*UpgradeServer) HandleRsp

func (s *UpgradeServer) HandleRsp(current *stnet.CurrentContent, msg *stnet.RspProto)

func (*UpgradeServer) HashProcessor

func (s *UpgradeServer) HashProcessor(current *stnet.CurrentContent) (processorID int)

func (*UpgradeServer) Loop

func (s *UpgradeServer) Loop()

func (*UpgradeServer) UpdateFile

func (s *UpgradeServer) UpdateFile(name string, index uint64) FileContent

Jump to

Keyboard shortcuts

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