selfcheck

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package selfcheck owns the Layer-2 defense: detect partial outpost corruption and self-heal from durable inputs.

Runs at boot + every 5 min. Each pass writes one structured event per failed invariant; the cloudbox-side heartbeat path (Layer 5) reads Status() to surface "selfcheck=fail" up to the operator dashboard.

Scope kept narrow — anything we can fix locally + cheaply gets fixed; anything that needs operator decision (e.g. corrupted host key, which would invalidate every peer's known_hosts) is reported loudly but NOT auto-rotated.

Index

Constants

View Source
const (
	StatusOK   = "ok"
	StatusWarn = "warn"
	StatusFail = "fail"
)

Status enum reported to the heartbeat path.

Variables

View Source
var (
	ErrNoConfig = errors.New("selfcheck: agent.json missing")
)

Errors callers may want to test against.

Functions

This section is empty.

Types

type CheckResult

type CheckResult struct {
	Status  string    `json:"status"`
	At      time.Time `json:"at"`
	Issues  []string  `json:"issues,omitempty"`
	Repairs []string  `json:"repairs,omitempty"`
}

CheckResult is one pass's outcome.

type Server

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

Server is the long-running worker. One per outpost.

func New

func New(cfgPath string) *Server

New constructs the worker. cfgPath is the on-disk agent.json path (DefaultConfigPath()). The Worker itself is cheap; Run does the work.

func (*Server) LastResult

func (s *Server) LastResult() CheckResult

LastResult returns the most recent full CheckResult.

func (*Server) LastStatus

func (s *Server) LastStatus() string

LastStatus returns the most recent check outcome (StatusOK/Warn/Fail). Safe to call from any goroutine.

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run drives the boot pass + 5min tick. Blocks until ctx.Done().

Jump to

Keyboard shortcuts

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