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 ¶
const ( StatusOK = "ok" StatusWarn = "warn" StatusFail = "fail" )
Status enum reported to the heartbeat path.
Variables ¶
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 ¶
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 ¶
LastStatus returns the most recent check outcome (StatusOK/Warn/Fail). Safe to call from any goroutine.