server

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package server is the SPECTRE server, which collects the quarantines that mirrors report. It keeps them in memory, so a restart loses them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectionFromMessage

func DirectionFromMessage(direction pb.Direction) (model.Direction, error)

DirectionFromMessage restores the direction a mirror reported.

func ReasonFromMessage

func ReasonFromMessage(message *pb.Quarantine) (model.QuarantineReason, error)

ReasonFromMessage restores the reason a mirror reported. Protobuf getters return plain strings, so the wire format is where named types are restored.

func Serve

func Serve(ctx context.Context, config ServeConfig) error

Serve runs a SPECTRE server until ctx is cancelled. Mesh mTLS secures it, so it serves plaintext HTTP/1 and unencrypted HTTP/2.

Types

type ClearConfig

type ClearConfig struct {
	Client      client.Config `embed:""`
	Service     string        `required:"" help:"Service whose divergences to clear."`
	Environment string        `required:"" help:"Environment whose divergences to clear."`
}

ClearConfig names the service environment whose divergences to clear.

type Reporter

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

Reporter sends each quarantine of a mirror's sources to the SPECTRE server.

func NewReporter

func NewReporter(config ReporterConfig, server *client.Client, sources ...Source) *Reporter

NewReporter reports the quarantines of a mirror's sources through server.

func (*Reporter) Run

func (r *Reporter) Run(ctx context.Context)

Run reports each source's quarantine until ctx is cancelled. A quarantine not yet reported when ctx is cancelled is lost.

type ReporterConfig

type ReporterConfig struct {
	Client      client.Config `embed:""`
	Service     string        `required:"" help:"Service the mirror runs, reported to the SPECTRE server."`
	Environment string        `required:"" help:"Environment the mirror runs in, such as production-us-west-2, reported to the SPECTRE server."`
	Revision    string        `required:"" help:"Commit of the candidate the mirror runs, reported to the SPECTRE server."`
}

ReporterConfig configures how a mirror reports quarantines to the SPECTRE server.

type ServeConfig

type ServeConfig struct {
	Listen string `default:"127.0.0.1:50070" help:"Address for the SPECTRE server: host:port, or unix:<path|@abstract>."`
}

ServeConfig configures the SPECTRE server.

type Service

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

Service serves the SPECTRE service API.

func NewService

func NewService() *Service

NewService returns a SPECTRE server with no divergences.

func (*Service) ClearDivergences

ClearDivergences removes the divergences of one service environment.

func (*Service) Handler

func (s *Service) Handler() http.Handler

Handler serves the API.

func (*Service) ListDivergences

ListDivergences returns the latest quarantine of each mirror direction.

func (*Service) Quarantine

Quarantine records that a mirror quarantined its candidate.

type Source

type Source struct {
	Direction model.Direction
	// Quarantined receives the proxy's quarantine once, when it begins.
	Quarantined <-chan model.Quarantine
}

Source is a proxy whose quarantine a mirror reports.

Directories

Path Synopsis
Package client calls the SPECTRE server.
Package client calls the SPECTRE server.

Jump to

Keyboard shortcuts

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