Documentation
¶
Index ¶
Constants ¶
View Source
const (
LastVersionURL = `https://api.github.com/repos/%s/releases/latest`
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OTA ¶
type OTA struct {
// contains filtered or unexported fields
}
OTA 提供版本检查和下载功能的结构体 OTA 只负责下载,不关心后续的解压、备份、替换等操作
func NewOTA ¶
NewOTA 创建 OTA 实例 repoName: GitHub 仓库名,如 "gowvp/owl",也支持 "github.com/gowvp/owl" 格式 filename: 下载的文件名
func (*OTA) GetLastVersion ¶
GetLastVersion 从 GitHub API 获取最新版本信息 返回 tag_name, body(release notes), error
func (*OTA) SetProgressCallback ¶
SetProgressCallback 设置下载进度回调
type ProgressReader ¶
type ProgressReader struct {
Total int64
Current atomic.Int64
io.Reader
OnProgress func(current, total int64)
// contains filtered or unexported fields
}
func NewProgressReader ¶
func NewProgressReader(total int64, reader io.Reader, onProgress func(current, total int64)) *ProgressReader
func (*ProgressReader) Close ¶
func (p *ProgressReader) Close()
func (*ProgressReader) Start ¶
func (p *ProgressReader) Start()
type ReleaseInfo ¶
ReleaseInfo GitHub Release 信息
Click to show internal directories.
Click to hide internal directories.