Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Notify is the template for displaying the payload to the user. Notify *template.Template )
Functions ¶
This section is empty.
Types ¶
type Advisory ¶
type Advisory struct {
Text string `json:"text"`
}
Advisory contains contents of security advisories.
type Latest ¶
type Latest struct { // Version is the new version name. Version string // Summary contains a brief description of the new version. Summary string // Link is a URL to a web page describing the new version. Link string }
Latest contains information about the most recent version.
type Payload ¶
type Payload struct { // Latest is set if there is a newer version to upgrade to. Latest *Latest `json:"latest"` // Advisory is set if security advisories exist for the current version. Advisory *Advisory `json:"advisory"` }
Payload returns information to the client about their existing version of a component.
type State ¶
State stores information about local runs of VerChecker to limit the frequency in which clients poll the service for information.
type VerChecker ¶
type VerChecker struct {
// contains filtered or unexported fields
}
VerChecker retrieves version information from the vercheck service.
func New ¶
func New(endpoint, statePath string) *VerChecker
New returns a new VerChecker for the endpoint.
func (*VerChecker) Check ¶
func (v *VerChecker) Check(ver string) (*Payload, error)
Check makes an HTTP request to endpoint to check if a new version or security advisories exist for the current version. Check tries to read the latest time it was run from the statePath, if found and 24 hours have not passed the check is skipped. When done, the latest time is updated in statePath.