Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PerformUpdate ¶
func PerformUpdate(ctx context.Context, info *UpdateInfo) error
PerformUpdate 执行更新
Types ¶
type Assets ¶
type Assets struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
Size int64 `json:"size"`
}
GitHubRelease GitHub Release API 响应结构
type GitHubRelease ¶
type GitHubRelease struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
Assets []*Assets `json:"assets"`
}
GitHubRelease GitHub Release API 响应结构
type Service ¶ added in v0.7.0
type Service struct {
// Runtime 是更新镜像和代理配置的只读快照。
Runtime *config.Runtime
// HTTPClient 是检查 Release 时使用的客户端。
HTTPClient *http.Client
// ReleaseURL 是 Release API 地址,空值使用 GitHub 默认地址。
ReleaseURL string
// CurrentVersion 覆盖默认编译版本,便于离线测试。
CurrentVersion string
}
Service 持有一次更新操作所需的显式配置和 HTTP 依赖。
func NewService ¶ added in v0.7.0
NewService 创建显式依赖的更新服务。
func (*Service) CheckUpdate ¶ added in v0.7.0
func (s *Service) CheckUpdate(ctx context.Context) (*UpdateInfo, error)
CheckUpdate 使用 Service 的 HTTP 客户端检查最新 Release。
func (*Service) PerformUpdate ¶ added in v0.7.0
func (s *Service) PerformUpdate(ctx context.Context, info *UpdateInfo) error
PerformUpdate 执行更新流程并复用现有原子替换实现。
Click to show internal directories.
Click to hide internal directories.