server

package
v1.9.0-ros1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2015 License: Apache-2.0 Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr struct {
	Proto string
	Addr  string
}

Addr contains string representation of address and its protocol (tcp, unix...).

type Config

type Config struct {
	Logging     bool
	EnableCors  bool
	CorsHeaders string
	Version     string
	SocketGroup string
	TLSConfig   *tls.Config
	Addrs       []Addr
}

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 a 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, error)

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) AcceptConnections

func (s *Server) AcceptConnections()

AcceptConnections allows clients to connect to the API server. Referenced Daemon is notified about this server, and waits for the daemon acknowledgement before the incoming connections are accepted.

func (*Server) Close

func (s *Server) Close()

Close closes servers and thus stop receiving requests

func (*Server) CreateMux

func (s *Server) CreateMux() *mux.Router

CreateMux initializes the main router the server uses. we keep enableCors just for legacy usage, need to be removed in the future

func (*Server) InitRouters

func (s *Server) InitRouters(d *daemon.Daemon)

InitRouters initializes a list of routers for the server. Sets those routers as Handler for each server.

func (*Server) ServeAPI

func (s *Server) ServeAPI() error

ServeAPI loops through all initialized servers and spawns goroutine with Serve() method for each.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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