-
Notifications
You must be signed in to change notification settings - Fork 1
/
lib.go
45 lines (36 loc) · 796 Bytes
/
lib.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package goupdater
import (
"time"
"github.com/goupdate/goupdater/lib"
)
type updater struct {
lib.ClientInfo
timeout time.Duration
}
func New(serverIpPort, key, project, branch string) *updater {
return &updater{
ClientInfo: lib.ClientInfo{
Server: serverIpPort,
Key: key,
Project: project,
Branch: branch,
},
timeout: 2*time.Minute,
}
}
func (u *updater) Check() (bool, error) {
return u.ClientInfo.Check()
}
func (u *updater) DownloadAndReplaceMe() error {
return u.ClientInfo.DownloadAndReplaceMe(u.timeout)
}
func (u *updater) Upload(branch string) error {
return u.ClientInfo.Upload(branch)
}
//set verbose to b
func (u *updater) Verbose(b bool) {
u.ClientInfo.Verbose = b
}
func (u *updater) SetDownloadTimeout(t time.Duration) {
u.timeout = t
}