exercise

package
v0.3.0-rc.53 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package exercise verifies observations of Beacon's deliberately failing drill endpoint. An observation is evidence that a location saw the deliberate response, independent of alert origin.

Index

Constants

View Source
const (
	Path               = "/drill/healthz"
	ChallengeHeader    = "X-Beacon-Exercise-Challenge"
	SampleHeader       = "X-Beacon-Exercise-Sample"
	ReceiptHeader      = "X-Beacon-Exercise-Receipt"
	ObservationPath    = "/api/v1/agent/exercise-observations"
	ActiveAtAnnotation = "beacon_rule_active_at"

	MaxToken = 2048 // upper bound for an exercise token in either direction
)

Variables

This section is empty.

Functions

func Assignment

func Assignment(labels map[string]string) string

Assignment identifies the observation's label set as stored by Prometheus-compatible metrics. Empty label values and absent labels identify the same series.

func Endpoint

func Endpoint(publicURL string) string

Endpoint is the exact HTTPS URL at the configured public origin that may issue drill receipts.

Types

type Authority

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

Authority signs narrowly purposed challenges and receipts with the centre's own key.

func New

func New(key []byte) *Authority

func (*Authority) Accept

func (a *Authority) Accept(run Run, token string, target Target, location, credential string, now time.Time) (Observation, bool)

Accept verifies a response under the same authenticated credential and current assignment. The store checks the run again while recording this proof.

func (*Authority) Issue

func (a *Authority) Issue(run Run, target Target, location, credential string, now time.Time) *Challenge

Issue binds the gateway-authenticated location and credential to its assigned target.

func (*Authority) Respond

func (a *Authority) Respond(run Run, token, host, sample string, now time.Time) string

Respond returns a receipt for a challenge only on the real endpoint during its current run.

type Challenge

type Challenge struct {
	Target string `json:"target"`
	Module string `json:"module"`
	Token  string `json:"challenge"`
}

Challenge is an optional addition to the enrolled probe's settings.

type Observation

type Observation struct {
	Target
	Run      string    `json:"run"`
	Location string    `json:"location"`
	Sampled  time.Time `json:"sample_at"`
	Served   time.Time `json:"served_at"`
	Recorded time.Time `json:"recorded_at"`
}

Observation is a verified report through an enrolled location.

type Run

type Run struct {
	ID    string    `json:"id,omitempty"`
	Armed time.Time `json:"armed_at,omitzero"`
	Until time.Time `json:"until,omitzero"`
	Ended time.Time `json:"ended_at,omitzero"`
}

Run identifies an activation of the built-in drill endpoint.

func (Run) Active

func (r Run) Active(now time.Time) bool

type Target

type Target struct {
	URL        string `json:"target"`
	Module     string `json:"module"`
	Assignment string `json:"assignment"`
}

Target identifies one exact configured check and its labels at assignment time.

Jump to

Keyboard shortcuts

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