v0.0.4 Latest Latest

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

Go to latest
Published: Jun 20, 2018 License: Apache-2.0 Imports: 21 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Config

type Config struct {
	// AuthManager
	AuthManager *auth.Manager

	RateLimiter RateType.RateLimiter

	// Port tcp port to listen on
	Port string

	// Host
	Host string

Config is base configuration object used by all transports

type ConfigTCP

type ConfigTCP struct {
	Scheme   string
	CertFile string
	KeyFile  string
	// contains filtered or unexported fields

ConfigTCP configuration of tcp transport

func NewConfigTCP

func NewConfigTCP(transport *Config) *ConfigTCP

NewConfigTCP allocate new transport config for tcp transport Use of this function is preferable instead of direct allocation of ConfigTCP

type ConfigWS

type ConfigWS struct {

	// AuthManager
	AuthManager *auth.Manager

	// CertFile
	CertFile string

	// KeyFile
	KeyFile string

	// Path
	Path string

	// SubProtocols
	SubProtocols []string
	// contains filtered or unexported fields

ConfigWS listener object for websocket server

func NewConfigWS

func NewConfigWS(transport *Config) *ConfigWS

NewConfigWS allocate new transport config for websocket transport Use of this function is preferable instead of direct allocation of ConfigWS

type InternalConfig

type InternalConfig struct {
	// AllowedVersions what protocol version server will handle
	// If not set than defaults to 0x3 and 0x04
	AllowedVersions map[packet.ProtocolVersion]bool

	Sessions *clients.Manager

	Metric systree.Metric

	// ConnectTimeout The number of seconds to wait for the CONNACK message before disconnecting.
	// If not set then default to 2 seconds.
	ConnectTimeout int

	// KeepAlive The number of seconds to keep the connection live if there's no data.
	// If not set then defaults to 5 minutes.
	KeepAlive int

InternalConfig used by server implementation to configure internal specific needs

type Provider

type Provider interface {
	Protocol() string
	Serve() error
	Close() error
	Port() string

Provider is interface that all of transports must implement

func NewTCP

func NewTCP(config *ConfigTCP, internal *InternalConfig) (Provider, error)

NewTCP create new tcp transport

func NewWS

func NewWS(config *ConfigWS, internal *InternalConfig) (Provider, error)

NewWS create new websocket transport

type TLSConnection added in v0.0.4

type TLSConnection struct {
	// contains filtered or unexported fields

TLSConnection wraps standard tls connection and implements the File function.

func (*TLSConnection) File added in v0.0.4

func (c *TLSConnection) File() (*os.File, error)

type TLSListener added in v0.0.4

type TLSListener struct {
	// contains filtered or unexported fields

TLSListener wraps standard tls listener.

func NewTLSListener added in v0.0.4

func NewTLSListener(inner net.Listener, config *tls.Config) *TLSListener

func (*TLSListener) Accept added in v0.0.4

func (l *TLSListener) Accept() (net.Conn, error)

Accept the next incoming connection and wraps it into tls Conn.

Jump to

Keyboard shortcuts

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