api

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 44 Imported by: 0

Documentation

Overview

Package api wires the HTTP surface together: REST endpoints for auth and Docker operations, the WebSocket upgrade, and serving the embedded SPA.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PProfHandler added in v1.4.0

func PProfHandler() http.Handler

PProfHandler returns an http.Handler exposing Go's net/http/pprof endpoints under /debug/pprof.

It carries NO authentication or IP filtering by design: the caller MUST serve it only on a loopback-bound listener (see cmd/dockercmd's pprof server). That is deliberate — gating by client IP on the *main* router would be unsafe, because the app runs behind chi's RealIP middleware, which rewrites r.RemoteAddr from the (spoofable) X-Forwarded-For / X-Real-IP headers. A physically loopback-only listener can't be reached off-box regardless of headers, so it's the correct boundary for endpoints that leak goroutine stacks / heap layout and can stall the process (/profile).

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server bundles all dependencies needed to serve HTTP.

func NewServer

func NewServer(cfg config.Config, st *store.Store, authSvc *auth.Service, mw *auth.Middleware, dm *docker.Manager, hub *ws.Hub, mon *monitor.Monitor, hist history.Store, webFS fs.FS) *Server

NewServer constructs the API server.

func (*Server) Handler

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

Handler builds the root http.Handler with all routes mounted.

Jump to

Keyboard shortcuts

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