api

package
v0.7.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 29 Imported by: 0

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:

  1. construct the *Server with its dependencies,
  2. mount unversioned routes (/health),
  3. 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).

func (*Server) Handler

func (s *Server) Handler() http.Handler

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL