checkpoint

package module
Version: v0.0.0-...-ebbb8b0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2017 License: MPL-2.0 Imports: 19 Imported by: 0

README

Go Checkpoint Client

Circle CI

Checkpoint is an internal service at Weaveworks to check version information, broadcast security bulletins, etc. This repository contains the client code for accessing that service. It is a fork of Hashicorp's Go Checkpoint Client and is embedded in several Weaveworks open source projects and proprietary software.

We understand that software making remote calls over the internet for any reason can be undesirable. Because of this, Checkpoint can be disabled in all of Weavework's software that includes it. You can view the source of this client to see that it is not sending any private information.

To disable checkpoint calls, set the CHECKPOINT_DISABLE environment variable, e.g.

export CHECKPOINT_DISABLE=1

Note: This repository is probably useless outside of internal Weaveworks use. It is open source for disclosure and because Weaveworks open source projects must be able to link to it.

Documentation

Overview

Package checkpoint is a package for checking version information and alerts for a Weaveworks product.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCheckDisabled

func IsCheckDisabled() bool

IsCheckDisabled returns true if checks are disabled.

Types

type CheckAlert

type CheckAlert struct {
	ID      int
	Date    int
	Message string
	URL     string
	Level   string
}

CheckAlert is a single alert message from a check request.

These never have to be manually constructed, and are typically populated into a CheckResponse as a result of the Check request.

type CheckParams

type CheckParams struct {
	// Product and version are used to lookup the correct product and
	// alerts for the proper version. The version is also used to perform
	// a version check.
	Product string
	Version string

	// Generic product flags
	Flags      map[string]string
	ExtraFlags func() []Flag

	// Arch and OS are used to filter alerts potentially only to things
	// affecting a specific os/arch combination. If these aren't specified,
	// they'll be automatically filled in.
	Arch string
	OS   string

	// Signature is some random signature that should be stored and used
	// as a cookie-like value. This ensures that alerts aren't repeated.
	// If the signature is changed, repeat alerts may be sent down. The
	// signature should NOT be anything identifiable to a user (such as
	// a MAC address). It should be random.
	//
	// If SignatureFile is given, then the signature will be read from this
	// file. If the file doesn't exist, then a random signature will
	// automatically be generated and stored here. SignatureFile will be
	// ignored if Signature is given.
	Signature     string
	SignatureFile string

	// CacheFile, if specified, will cache the result of a check. The
	// duration of the cache is specified by CacheDuration, and defaults
	// to 48 hours if not specified. If the CacheFile is newer than the
	// CacheDuration, than the Check will short-circuit and use those
	// results.
	//
	// If the CacheFile directory doesn't exist, it will be created with
	// permissions 0755.
	CacheFile     string
	CacheDuration time.Duration

	// Force, if true, will force the check even if CHECKPOINT_DISABLE
	// is set. Within HashiCorp products, this is ONLY USED when the user
	// specifically requests it. This is never automatically done without
	// the user's consent.
	Force bool
}

CheckParams are the parameters for configuring a check request.

type CheckResponse

type CheckResponse struct {
	Product             string
	CurrentVersion      string `json:"current_version"`
	CurrentReleaseDate  int    `json:"current_release_date"`
	CurrentDownloadURL  string `json:"current_download_url"`
	CurrentChangelogURL string `json:"current_changelog_url"`
	ProjectWebsite      string `json:"project_website"`
	Outdated            bool   `json:"outdated"`
	Alerts              []*CheckAlert
}

CheckResponse is the response for a check request.

func Check

func Check(p *CheckParams) (*CheckResponse, error)

Check checks for alerts and new version information.

type Checker

type Checker struct {
	// contains filtered or unexported fields
}

Checker is a state of a checker.

func CheckInterval

func CheckInterval(p *CheckParams, interval time.Duration,
	cb func(*CheckResponse, error)) *Checker

CheckInterval is used to check for a response on a given interval duration. The interval is not exact, and checks are randomized to prevent a thundering herd. However, it is expected that on average one check is performed per interval. The first check happens immediately after a goroutine which is responsible for making checks has been started.

func (*Checker) NextCheckAt

func (c *Checker) NextCheckAt() time.Time

NextCheckAt returns at what time next check will happen.

func (*Checker) Stop

func (c *Checker) Stop()

Stop stops the checker.

type Flag

type Flag struct {
	Key   string
	Value string
}

Flag is some extra information about a product we want to pass along.

Source Files

Jump to

Keyboard shortcuts

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