server

package
v23.0.11+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.9.0

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 added in v1.9.0

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 added in v1.9.0

func (s *HTTPServer) Close() error

Close closes the HTTPServer from listening for the inbound requests.

func (*HTTPServer) Serve added in v1.9.0

func (s *HTTPServer) Serve() error

Serve starts listening for inbound requests.

type Server added in v1.4.0

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

Server contains instance details for the server

func New added in v1.7.0

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 added in v1.11.0

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

Accept sets a listener the server accepts connections into.

func (*Server) Close added in v1.4.0

func (s *Server) Close()

Close closes servers and thus stop receiving requests

func (*Server) InitRouter added in v1.11.0

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 added in v1.12.0

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 added in v1.10.0

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.

Jump to

Keyboard shortcuts

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