vercheck

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

type State struct {
	CheckedAt time.Time `json:"checkedat"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL