server

package
v2.2.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigurationWatcher added in v2.1.0

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

ConfigurationWatcher watches configuration changes.

func NewConfigurationWatcher added in v2.1.0

func NewConfigurationWatcher(
	routinesPool *safe.Pool,
	pvd provider.Provider,
	providersThrottleDuration time.Duration,
	defaultEntryPoints []string,
) *ConfigurationWatcher

NewConfigurationWatcher creates a new ConfigurationWatcher.

func (*ConfigurationWatcher) AddListener added in v2.1.0

func (c *ConfigurationWatcher) AddListener(listener func(dynamic.Configuration))

AddListener adds a new listener function used when new configuration is provided

func (*ConfigurationWatcher) Start added in v2.1.0

func (c *ConfigurationWatcher) Start()

Start the configuration watcher.

func (*ConfigurationWatcher) Stop added in v2.1.0

func (c *ConfigurationWatcher) Stop()

Stop the configuration watcher.

type RouterFactory added in v2.2.0

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

RouterFactory the factory of TCP/UDP routers.

func NewRouterFactory added in v2.2.0

func NewRouterFactory(staticConfiguration static.Configuration, managerFactory *service.ManagerFactory, tlsManager *tls.Manager, chainBuilder *middleware.ChainBuilder) *RouterFactory

NewRouterFactory creates a new RouterFactory

func (*RouterFactory) CreateRouters added in v2.2.0

func (f *RouterFactory) CreateRouters(conf dynamic.Configuration) (map[string]*tcpCore.Router, map[string]udpCore.Handler)

CreateRouters creates new TCPRouters and UDPRouters

type Server

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

Server is the reverse-proxy/load-balancer engine

func NewServer

func NewServer(routinesPool *safe.Pool, entryPoints TCPEntryPoints, entryPointsUDP UDPEntryPoints, watcher *ConfigurationWatcher,
	chainBuilder *middleware.ChainBuilder, accessLoggerMiddleware *accesslog.Handler) *Server

NewServer returns an initialized Server.

func (*Server) Close

func (s *Server) Close()

Close destroys the server

func (*Server) Start

func (s *Server) Start(ctx context.Context)

Start starts the server and Stop/Close it when context is Done

func (*Server) Stop

func (s *Server) Stop()

Stop stops the server

func (*Server) Wait

func (s *Server) Wait()

Wait blocks until the server shutdown.

type TCPEntryPoint

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

TCPEntryPoint is the TCP server

func NewTCPEntryPoint

func NewTCPEntryPoint(ctx context.Context, configuration *static.EntryPoint) (*TCPEntryPoint, error)

NewTCPEntryPoint creates a new TCPEntryPoint

func (*TCPEntryPoint) Shutdown

func (e *TCPEntryPoint) Shutdown(ctx context.Context)

Shutdown stops the TCP connections

func (*TCPEntryPoint) Start added in v2.2.0

func (e *TCPEntryPoint) Start(ctx context.Context)

Start starts the TCP server.

func (*TCPEntryPoint) SwitchRouter added in v2.1.0

func (e *TCPEntryPoint) SwitchRouter(rt *tcp.Router)

SwitchRouter switches the TCP router handler.

type TCPEntryPoints

type TCPEntryPoints map[string]*TCPEntryPoint

TCPEntryPoints holds a map of TCPEntryPoint (the entrypoint names being the keys)

func NewTCPEntryPoints added in v2.1.0

func NewTCPEntryPoints(entryPointsConfig static.EntryPoints) (TCPEntryPoints, error)

NewTCPEntryPoints creates a new TCPEntryPoints.

func (TCPEntryPoints) Start added in v2.1.0

func (eps TCPEntryPoints) Start()

Start the server entry points.

func (TCPEntryPoints) Stop added in v2.1.0

func (eps TCPEntryPoints) Stop()

Stop the server entry points.

func (TCPEntryPoints) Switch added in v2.1.0

func (eps TCPEntryPoints) Switch(routersTCP map[string]*tcp.Router)

Switch the TCP routers.

type UDPEntryPoint added in v2.2.0

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

UDPEntryPoint is an entry point where we listen for UDP packets.

func NewUDPEntryPoint added in v2.2.0

func NewUDPEntryPoint(cfg *static.EntryPoint) (*UDPEntryPoint, error)

NewUDPEntryPoint returns a UDP entry point.

func (*UDPEntryPoint) Shutdown added in v2.2.0

func (ep *UDPEntryPoint) Shutdown(ctx context.Context)

Shutdown closes ep's listener. It eventually closes all "sessions" and releases associated resources, but only after it has waited for a graceTimeout, if any was configured.

func (*UDPEntryPoint) Start added in v2.2.0

func (ep *UDPEntryPoint) Start(ctx context.Context)

Start commences the listening for ep.

func (*UDPEntryPoint) Switch added in v2.2.0

func (ep *UDPEntryPoint) Switch(handler udp.Handler)

Switch replaces ep's handler with the one given as argument.

type UDPEntryPoints added in v2.2.0

type UDPEntryPoints map[string]*UDPEntryPoint

UDPEntryPoints maps UDP entry points by their names.

func NewUDPEntryPoints added in v2.2.0

func NewUDPEntryPoints(cfg static.EntryPoints) (UDPEntryPoints, error)

NewUDPEntryPoints returns all the UDP entry points, keyed by name.

func (UDPEntryPoints) Start added in v2.2.0

func (eps UDPEntryPoints) Start()

Start commences the listening for all the entry points.

func (UDPEntryPoints) Stop added in v2.2.0

func (eps UDPEntryPoints) Stop()

Stop makes all the entry points stop listening, and release associated resources.

func (UDPEntryPoints) Switch added in v2.2.0

func (eps UDPEntryPoints) Switch(handlers map[string]udp.Handler)

Switch swaps out all the given handlers in their associated entrypoints.

Directories

Path Synopsis
tcp
udp
tcp
udp

Jump to

Keyboard shortcuts

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