package server

import "github.com/docker/docker/api/server"

Index

Types

type Config

type Config struct {
	CorsHeaders string
	Version     string
	SocketGroup string
	TLSConfig   *tls.Config
	// Hosts is a list of addresses for the API to listen on.
	Hosts []string
}

Config provides the configuration for the API server

type HTTPServer

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

HTTPServer contains an instance of http server and the listener. srv *http.Server, contains configuration to create an http server and a mux router with all api end points. l net.Listener, is a TCP or Socket listener that dispatches incoming request to the router.

func (*HTTPServer) Close

func (s *HTTPServer) Close() error

Close closes the HTTPServer from listening for the inbound requests.

func (*HTTPServer) Serve

func (s *HTTPServer) Serve() error

Serve starts listening for inbound requests.

type Server

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

Server contains instance details for the server

func New

func New(cfg *Config) *Server

New returns a new instance of the server based on the specified configuration. It allocates resources which will be needed for ServeAPI(ports, unix-sockets).

func (*Server) Accept

func (s *Server) Accept(addr string, listeners ...net.Listener)

Accept sets a listener the server accepts connections into.

func (*Server) Close

func (s *Server) Close()

Close closes servers and thus stop receiving requests

func (*Server) InitRouter

func (s *Server) InitRouter(routers ...router.Router)

InitRouter initializes the list of routers for the server. This method also enables the Go profiler.

func (*Server) UseMiddleware

func (s *Server) UseMiddleware(m middleware.Middleware)

UseMiddleware appends a new middleware to the request chain. This needs to be called before the API routes are configured.

func (*Server) Wait

func (s *Server) Wait(waitChan chan error)

Wait blocks the server goroutine until it exits. It sends an error message if there is any error during the API execution.

Source Files

errorhandler.go middleware.go server.go

Directories

PathSynopsis
api/server/backend
api/server/backend/build
api/server/httpstatus
api/server/httputils
api/server/middleware
api/server/router
api/server/router/build
api/server/router/checkpoint
api/server/router/container
api/server/router/debug
api/server/router/distribution
api/server/router/grpc
api/server/router/image
api/server/router/network
api/server/router/plugin
api/server/router/session
api/server/router/swarm
api/server/router/system
api/server/router/volume
Version
v23.0.3+incompatible
Published
Apr 4, 2023
Platform
js/wasm
Imports
17 packages
Last checked
now

Tools for package owners.