Documentation
¶
Overview ¶
Package api is Headmesh's public REST API (OpenAPI 3.1, RFC 9457 errors), a thin layer over package service.
Every operation either declares the "bearer" security requirement — enforced by middleware, which turns the API key into a service.Principal — or is on the short public allowlist (device enrollment, which carries its own one-time credentials). TestEveryOperationIsAuthenticatedOrAllowlisted keeps it that way.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var PublicOperations = map[string]bool{"enroll": true, "complete-enrollment": true}
PublicOperations are reachable without an API key.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Service *service.Service
Logger *slog.Logger
// TrustForwardedFor makes the API take the client address from X-Forwarded-For (set by Caddy). Enable only
// when every request arrives through the trusted proxy.
TrustForwardedFor bool
// EnrollPerMinute limits enrollment calls per client address (default 30).
EnrollPerMinute int
Version string
}
Options configure the API.
type Recovery ¶
type Recovery struct {
// contains filtered or unexported fields
}
Recovery gates the API while a restored control plane catches up (plan §13.4): /readyz answers 503 and every request that could change state gets 503 with Retry-After, until End is called. Reads keep working, so operators can inspect grants and audit while cells catch up. The zero value (and a nil *Recovery) is open.