Documentation
¶
Overview ¶
Package server exposes an mqlite Engine as a Connect-style JSON-over-HTTP broker (design §7). Every unary RPC is a plain HTTP POST to /mqlite.v1.<Service>/<Method> with a JSON body — curl-able by construction. A durable broker Engine preserves live tokens under engine.Open's safe default. The higher-level Embedded.Serve path additionally enforces WithBrokerMode so its shutdown and lifecycle contract is selected before serving traffic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateMonitorTokens ¶ added in v0.3.2
ValidateMonitorTokens rejects ambiguous or ineffective monitoring credentials. Errors describe configuration only and never contain a credential value.
Types ¶
type Server ¶
type Server struct {
Version string // reported by the open "/" discovery endpoint; "" -> "dev"
CORS string // Access-Control-Allow-Origin to send; "" -> CORS off (see cors.go)
Logger *slog.Logger // per-request access log; nil -> no request logging (see logging.go)
UI bool // serve the embedded admin console at /ui (see console.go)
// Metrics enables authenticated GET /metrics on the API listener and includes
// its path in discovery. Off by default; configure before Handler is used.
Metrics bool
// MonitorTokens grants only Observe and /metrics. Configure before Handler is
// used. These credentials never consult the database and cannot manage keys.
MonitorTokens []string
// MaxBodyBytes bounds any single RPC request body BEFORE JSON decoding
// (review F8): without it a multi-GB body OOMs the broker before the
// per-message MaxMessageBytes check ever runs. Bodies are base64 (x4/3) and
// a batched Send carries many messages, so the default (32 MiB) sits far
// above normal use while keeping one hostile request a fraction of the
// smallest supported deployment's RAM. Over the cap -> 413 message_too_large.
MaxBodyBytes int64
// contains filtered or unexported fields
}
Server adapts an Engine to HTTP with static administrators and managed access keys.