transport

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

	// Port tcp port to listen on
	Port int

	// Anonymous either allow or deny anonymous access
	// If not set than default is false
	Anonymous bool
}

Config is base configuration object used by all transports

type ConfigTCP

type ConfigTCP struct {
	// Scheme
	Scheme string

	// Host
	Host string

	// CertFile
	CertFile string

	// KeyFile
	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[message.ProtocolVersion]bool

	Sessions *sessions.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() int
}

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

Jump to

Keyboard shortcuts

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