listeners

package
v0.0.0-...-8b1022e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultListener

func NewDefaultListener(l net.Listener) net.Listener

func NewIdleConnListener

func NewIdleConnListener(l net.Listener, timeout time.Duration) net.Listener

func NewLimitedListener

func NewLimitedListener(l net.Listener, maxConns uint64) net.Listener

func NewMeasuredListener

func NewMeasuredListener(l net.Listener, reportInterval time.Duration, m *measured.Measured) net.Listener

Types

type WrapConn

type WrapConn interface {
	// net.Conn interface
	Read(b []byte) (n int, err error)
	Write(b []byte) (n int, err error)
	Close() error
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	SetDeadline(t time.Time) error
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error

	// Additional functionality
	OnState(s http.ConnState)
	ControlMessage(msgType string, data interface{})
}

WrapConn is an interface that describes a connection that an be wrapped and wrap other connections. It responds to connection changes with OnState, and allows control messages with ControlMessage (for things like modify the connection at the wrapper level). It is important that these functions, when defined, pass the arguments to the wrapped connections.

type WrapConnEmbeddable

type WrapConnEmbeddable interface {
	OnState(s http.ConnState)
	ControlMessage(msgType string, data interface{})
}

WrapConnEmbeddable can be embedded along net.Conn or not

Jump to

Keyboard shortcuts

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