server

package
v0.0.0-...-6789dc4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package server contains code to start server components hosted by the subpackages.

Index

Constants

This section is empty.

Variables

View Source
var (
	BootLogger = logger.NewSimpleLogger(os.Stderr, "debug")
	// Boot logging helpers through BootLogger.
	BootLogListener func(kind string, lst net.Listener) = bootLogListener
	BootLogFatalf                                       = BootLogger.Fatalf
)

Functions

func DevicesRunner

func DevicesRunner(adoptLst net.Listener, session func(net.Conn) error, logger logger.Logger, resource listener.SessionResourceManager, parsedCfg *DevicesParsedConfig) func()

DevicesRunner returns a function to accept device connections. If adoptLst is not nil it will be used as the underlying listener, instead of creating one, wrapped in a TLS layer.

func HTTPServeRunner

func HTTPServeRunner(httpLst net.Listener, h http.Handler, parsedCfg *HTTPServeParsedConfig, tlsCfg *tls.Config) func()

HTTPServeRunner returns a function to serve HTTP requests. If httpLst is not nil it will be used as the underlying listener. If tlsCfg is not nit server over TLS with the config.

Types

type DevicesParsedConfig

type DevicesParsedConfig struct {
	// session configuration
	ParsedPingInterval    config.ConfigTimeDuration `json:"ping_interval"`
	ParsedExchangeTimeout config.ConfigTimeDuration `json:"exchange_timeout"`
	// broker configuration
	ParsedSessionQueueSize config.ConfigQueueSize `json:"session_queue_size"`
	ParsedBrokerQueueSize  config.ConfigQueueSize `json:"broker_queue_size"`
	// device listener configuration
	ParsedAddr config.ConfigHostPort `json:"addr"`
	TLSParsedConfig
}

A DevicesParsedConfig holds and can be used to parse the device server config.

func (*DevicesParsedConfig) Addr

func (cfg *DevicesParsedConfig) Addr() string

func (*DevicesParsedConfig) BrokerQueueSize

func (cfg *DevicesParsedConfig) BrokerQueueSize() uint

func (*DevicesParsedConfig) ExchangeTimeout

func (cfg *DevicesParsedConfig) ExchangeTimeout() time.Duration

func (*DevicesParsedConfig) PingInterval

func (cfg *DevicesParsedConfig) PingInterval() time.Duration

func (*DevicesParsedConfig) SessionQueueSize

func (cfg *DevicesParsedConfig) SessionQueueSize() uint

type HTTPServeParsedConfig

type HTTPServeParsedConfig struct {
	ParsedHTTPAddr         config.ConfigHostPort     `json:"http_addr"`
	ParsedHTTPReadTimeout  config.ConfigTimeDuration `json:"http_read_timeout"`
	ParsedHTTPWriteTimeout config.ConfigTimeDuration `json:"http_write_timeout"`
}

A HTTPServeParsedConfig holds and can be used to parse the HTTP server config.

type TLSParsedConfig

type TLSParsedConfig struct {
	ParsedKeyPEMFile  string `json:"key_pem_file"`
	ParsedCertPEMFile string `json:"cert_pem_file"`
	// contains filtered or unexported fields
}

A TLSParsedConfig holds and can be used to parse a tls server config.

func (*TLSParsedConfig) LoadPEMs

func (cfg *TLSParsedConfig) LoadPEMs(baseDir string) error

func (*TLSParsedConfig) TLSServerConfig

func (cfg *TLSParsedConfig) TLSServerConfig() *tls.Config

Directories

Path Synopsis
Package acceptance contains the acceptance client.
Package acceptance contains the acceptance client.
cmd
acceptanceclient command for playing.
acceptanceclient command for playing.
kit
Package kit contains reusable building blocks for acceptance.
Package kit contains reusable building blocks for acceptance.
suites
Package suites contains reusable acceptance test suites.
Package suites contains reusable acceptance test suites.
Package api has code that offers a REST API for the applications that want to push messages.
Package api has code that offers a REST API for the applications that want to push messages.
Package broker handles session registrations and delivery of messages through sessions.
Package broker handles session registrations and delivery of messages through sessions.
simple
Package simple implements a simple broker for just one process.
Package simple implements a simple broker for just one process.
testing
Package testing contains simple test implementations of some broker interfaces.
Package testing contains simple test implementations of some broker interfaces.
testsuite
Package testsuite contains a common test suite for brokers.
Package testsuite contains a common test suite for brokers.
Dev is a simple development server.
Dev is a simple development server.
Package listener has code to listen for device connections and setup sessions for them.
Package listener has code to listen for device connections and setup sessions for them.
Package session has code handling long-lived connections from devices.
Package session has code handling long-lived connections from devices.
Package store takes care of storing pending notifications.
Package store takes care of storing pending notifications.

Jump to

Keyboard shortcuts

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