Documentation ¶
Index ¶
Constants ¶
const ( // OSKeyName is the url parameter key to send to the checkin API for the operating system of the local netscale (e.g. windows, darwin, linux) OSKeyName = "os" // ArchitectureKeyName is the url parameter key to send to the checkin API for the architecture of the local netscale (e.g. amd64, x86) ArchitectureKeyName = "arch" // BetaKeyName is the url parameter key to send to the checkin API to signal if the update should be a beta version or not BetaKeyName = "beta" // VersionKeyName is the url parameter key to send to the checkin API to specific what version to upgrade or downgrade to VersionKeyName = "version" // ClientVersionName is the url parameter key to send the version that this netscale is currently running with ClientVersionName = "clientVersion" )
const ( DefaultCheckUpdateFreq = time.Hour * 24 UpdateURL = "https://update.argotunnel.com" StagingUpdateURL = "https://staging-update.argotunnel.com" LogFieldVersion = "version" )
Variables ¶
var (
BuiltForPackageManager = ""
)
Functions ¶
Types ¶
type AutoUpdater ¶
type AutoUpdater struct {
// contains filtered or unexported fields
}
AutoUpdater periodically checks for new version of netscale.
func NewAutoUpdater ¶
type CheckResult ¶
CheckResult is the behaviour resulting from checking in with the Update Service
func CheckForUpdate ¶
func CheckForUpdate(options updateOptions) (CheckResult, error)
func NewWorkersVersion ¶
func NewWorkersVersion(url, version, checksum, targetPath, userMessage string, isCompressed bool) CheckResult
NewWorkersVersion creates a new Version object. This is normally created by a WorkersService JSON checkin response url is where to download the file version is the version of this update checksum is the expected checksum of the downloaded file target path is where the file should be replace. Normally this the running netscale's path userMessage is a possible message to convey back to the user after having checked in with the Updater Service isCompressed tells whether the asset to update netscale is compressed or not
type Options ¶
type Options struct { // IsBeta is for beta updates to be installed if available IsBeta bool // IsForced is to forcibly download the latest version regardless of the current version IsForced bool // RequestedVersion is the specific version to upgrade or downgrade to RequestedVersion string }
Options are the update options supported by the
type Service ¶
type Service interface {
Check() (CheckResult, error)
}
Service is the functions to get check for new updates
func NewWorkersService ¶
NewWorkersService creates a new updater Service object.
type UpdateOutcome ¶
type VersionResponse ¶
type VersionResponse struct { URL string `json:"url"` Version string `json:"version"` Checksum string `json:"checksum"` IsCompressed bool `json:"compressed"` UserMessage string `json:"userMessage"` ShouldUpdate bool `json:"shouldUpdate"` Error string `json:"error"` }
VersionResponse is the JSON response from the Workers API endpoint
type VersionWarningChecker ¶
type VersionWarningChecker struct {
// contains filtered or unexported fields
}
func StartWarningCheck ¶
func StartWarningCheck(c *cli.Context) VersionWarningChecker
func (VersionWarningChecker) LogWarningIfAny ¶
func (checker VersionWarningChecker) LogWarningIfAny(log *zerolog.Logger)
type WorkersService ¶
type WorkersService struct {
// contains filtered or unexported fields
}
WorkersService implements Service. It contains everything needed to check in with the WorkersAPI and download and apply the updates
func (*WorkersService) Check ¶
func (s *WorkersService) Check() (CheckResult, error)
Check does a check in with the Workers API to get a new version update
type WorkersVersion ¶
type WorkersVersion struct {
// contains filtered or unexported fields
}
WorkersVersion implements the Version interface. It contains everything needed to perform a version upgrade
func (*WorkersVersion) Apply ¶
func (v *WorkersVersion) Apply() error
Apply does the actual verification and update logic. This includes signature and checksum validation, replacing the binary, etc
func (*WorkersVersion) UserMessage ¶
func (v *WorkersVersion) UserMessage() string
String returns a possible message to convey back to user after having checked in with the Updater Service. E.g. it can warn about the need to update the version currently running.
func (*WorkersVersion) Version ¶
func (v *WorkersVersion) Version() string
String returns the version number of this update/release (e.g. 2020.08.05)