transport

package
Version: v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: Apache-2.0 Imports: 15 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrListenerIsOff ...
	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
}

Handler ...

type InternalConfig

type InternalConfig struct {
	Handler
	// EPoll      netpoll.EventPoll
	AcceptPool types.Pool
	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