transport

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrListenerIsOff = errors.New("listener is off")
)

Functions

This section is empty.

Types

type Config

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

	Host string
	// Port tcp port to listen on
	Port string
}

Config is base configuration object used by all transports

type ConfigTCP

type ConfigTCP struct {
	Scheme string
	TLS    *tls.Config
	// 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 {
	// 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 Conn added in v0.0.4

type Conn interface {
	net.Conn
}

Conn is wrapper to net.Conn Implemented to encapsulate bytes statistic

type Handler added in v0.0.4

type Handler interface {
	OnConnection(Conn, *auth.Manager) error
}

type InternalConfig

type InternalConfig struct {
	Handler
	Metric systree.Metric
}

InternalConfig used by server implementation to configure internal specific needs

type Provider

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

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