internal

package
v2.13.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSysFd

func GetSysFd(conn net.Conn) (int, error)

GetSysFd returns the underlying fd of a connection.

Types

type ConnectionID

type ConnectionID struct {
	Local      v2net.Address
	Remote     v2net.Address
	RemotePort v2net.Port
}

ConnectionID is the ID of a connection.

func NewConnectionID

func NewConnectionID(source v2net.Address, dest v2net.Destination) ConnectionID

NewConnectionID creates a new ConnectionId.

type ConnectionRecyler

type ConnectionRecyler interface {
	// Put returns a connection back to a connection pool.
	Put(ConnectionID, net.Conn)
}

ConnectionRecyler is the interface for recycling connections.

type ExpiringConnection

type ExpiringConnection struct {
	// contains filtered or unexported fields
}

ExpiringConnection is a connection that will expire in certain time.

func (*ExpiringConnection) Expired

func (ec *ExpiringConnection) Expired() bool

Expired returns true if the connection has expired.

type Pool

type Pool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Pool is a connection pool.

func NewConnectionPool

func NewConnectionPool() *Pool

NewConnectionPool creates a new Pool.

func (*Pool) Get

func (p *Pool) Get(id ConnectionID) net.Conn

Get returns a connection with matching connection ID. Nil if not found.

func (*Pool) Put

func (p *Pool) Put(id ConnectionID, conn net.Conn)

Put implements ConnectionRecyler.Put().

Jump to

Keyboard shortcuts

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