Documentation
¶
Overview ¶
Package api wires the top-level HTTP server. It is intentionally thin — per-version routing lives in subpackages (pkg/api/v1, ...) and shared HTTP helpers live in pkg/api/apihttp. This file's job is:
- construct the *Server with its dependencies,
- mount unversioned routes (/health),
- delegate /v1/... (and any future version) to that version's RegisterRoutes function.
To add a new version: create pkg/api/vN mirroring pkg/api/v1, then add a single vN.RegisterRoutes(...) call below. Versions coexist on the same mux without modifying each other.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(logger *slog.Logger, service *service.Service, dockerClient *docker.Client, builder apiv1.ImageBuilder, cfg config.Config, patToken string, validator controlplane.Validator) *Server
NewServer constructs the API server. validator is the second-token (non-PAT) validation path; pass controlplane.Noop().Validator (or any rejecting validator) for the open-source PAT-only behavior. A nil validator is treated as reject-all so callers can't accidentally open the door by omission.
builder is the image-builder the /images/build + snapshot-from-Dockerfile paths use. On the dockerd engine this is the *docker.Client; on the containerd engine the daemon passes a buildkit-backed builder. A nil builder falls back to dockerClient so existing docker-only callers are unaffected; when both are nil the build endpoints return 503 (builder not configured).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apihttp holds HTTP helpers shared by every version of the public API (pkg/api/v1, ...).
|
Package apihttp holds HTTP helpers shared by every version of the public API (pkg/api/v1, ...). |
|
Package ingressproxy implements the loopback HTTP listener that fronts wake-aware Caddy port routes.
|
Package ingressproxy implements the loopback HTTP listener that fronts wake-aware Caddy port routes. |
|
Package v1 implements the v1 HTTP API for the sandbox daemon.
|
Package v1 implements the v1 HTTP API for the sandbox daemon. |