tcp

package
v0.9.4-rc1.0...-49327f6 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout is the default length of time to wait for first byte.
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func Dial

func Dial(network, address string, header byte) (net.Conn, error)

Dial connects to a remote mux listener with a given header byte.

Types

type Mux

type Mux struct {

	// The amount of time to wait for the first header byte.
	Timeout time.Duration

	// Out-of-band error logger
	Logger *log.Logger
	// contains filtered or unexported fields
}

Mux multiplexes a network connection.

func NewMux

func NewMux() *Mux

NewMux returns a new instance of Mux for ln.

func (*Mux) Listen

func (mux *Mux) Listen(header byte) net.Listener

Listen returns a listener identified by header. Any connection accepted by mux is multiplexed based on the initial header byte.

func (*Mux) Serve

func (mux *Mux) Serve(ln net.Listener) error

Serve handles connections from ln and multiplexes then across registered listener.

Jump to

Keyboard shortcuts

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