Expand description
Axum router on a Unix domain socket; the serve entrypoint.
Per 20-firecracker-api.md § 2:
- Every response carries
Server: Firecracker API(aSetResponseHeaderLayer). - Bodies above
--http-api-max-payload-sizereturn413 Payload Too Largeviatower_http::limit::RequestBodyLimitLayer. - Unknown paths are translated by the fallback into
400 BadRequestwith{"fault_message": "No such resource: ..."}.
The handler set lives in crate::handlers; this module is just plumbing.
Structs§
- Serve
Options - Configuration for
serve.
Constants§
- DEFAULT_
MAX_ PAYLOAD - Default Firecracker-compat HTTP body limit (51200 bytes); overridable via
ServeOptions. - FIRECRACKER_
SERVER_ HEADER - The literal value upstream Firecracker emits for the
Serverheader. SDKs and orchestrator-side smoke tests sniff this string; we emit it verbatim. - MAX_
MAX_ PAYLOAD - Upper bound on the body limit.
- MIN_
MAX_ PAYLOAD - Lower bound on the body limit (70-security.md § 6).
Functions§
- bind_
listener - Bind a Unix domain socket for
serve_bound. - router
- Build the axum router with all middleware applied. Exposed for use in integration
tests (callers can wrap it in
axum::serveagainst anytokio::net::UnixListener). - serve
- Bind a Unix domain socket and serve the API on it until the future is dropped.
- serve_
bound - Serve the API on an already-bound Unix listener until the future is dropped.
- unlink_
socket_ if_ exists - Best-effort cleanup helper: unlinks
pathif present, ignoringNotFound.