tcp

package
v1.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosedListener = errors.New("Listener is closed.")
)
View Source
var (
	ErrInvalidConn = errors.New("Invalid Connection.")
)

Functions

func Dial

func DialRaw

func DialRaw(src v2net.Address, dest v2net.Destination) (internet.Connection, error)

func FindFirstValid

func FindFirstValid(list []*AwaitingConnection) int

func ListenRawTCP

func ListenRawTCP(address v2net.Address, port v2net.Port) (internet.Listener, error)

func ListenTCP

func ListenTCP(address v2net.Address, port v2net.Port) (internet.Listener, error)

Types

type AwaitingConnection

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

func (*AwaitingConnection) Expired

func (this *AwaitingConnection) Expired() bool

type Config

type Config struct {
	ConnectionReuse bool
}

func (*Config) Apply

func (this *Config) Apply()

func (*Config) UnmarshalJSON

func (this *Config) UnmarshalJSON(data []byte) error

type Connection

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

func NewConnection

func NewConnection(dest string, conn net.Conn, manager ConnectionManager) *Connection

func (*Connection) Close

func (this *Connection) Close() error

func (*Connection) LocalAddr

func (this *Connection) LocalAddr() net.Addr

func (*Connection) Read

func (this *Connection) Read(b []byte) (int, error)

func (*Connection) RemoteAddr

func (this *Connection) RemoteAddr() net.Addr

func (*Connection) Reusable

func (this *Connection) Reusable() bool

func (*Connection) SetDeadline

func (this *Connection) SetDeadline(t time.Time) error

func (*Connection) SetReadDeadline

func (this *Connection) SetReadDeadline(t time.Time) error

func (*Connection) SetReusable

func (this *Connection) SetReusable(reusable bool)

func (*Connection) SetWriteDeadline

func (this *Connection) SetWriteDeadline(t time.Time) error

func (*Connection) SysFd

func (this *Connection) SysFd() (int, error)

func (*Connection) Write

func (this *Connection) Write(b []byte) (int, error)

type ConnectionCache

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

func NewConnectionCache

func NewConnectionCache() *ConnectionCache

func (*ConnectionCache) Cleanup

func (this *ConnectionCache) Cleanup()

func (*ConnectionCache) Get

func (this *ConnectionCache) Get(dest string) net.Conn

func (*ConnectionCache) Recycle

func (this *ConnectionCache) Recycle(dest string, conn net.Conn)

type ConnectionManager

type ConnectionManager interface {
	Recycle(string, net.Conn)
}

type ConnectionWithError

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

type RawConnection

type RawConnection struct {
	net.TCPConn
}

func (*RawConnection) Reusable

func (this *RawConnection) Reusable() bool

func (*RawConnection) SetReusable

func (this *RawConnection) SetReusable(b bool)

func (*RawConnection) SysFd

func (this *RawConnection) SysFd() (int, error)

type RawTCPListener

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

func (*RawTCPListener) Accept

func (this *RawTCPListener) Accept() (internet.Connection, error)

func (*RawTCPListener) Addr

func (this *RawTCPListener) Addr() net.Addr

func (*RawTCPListener) Close

func (this *RawTCPListener) Close() error

type TCPListener

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

func (*TCPListener) Accept

func (this *TCPListener) Accept() (internet.Connection, error)

func (*TCPListener) Addr

func (this *TCPListener) Addr() net.Addr

func (*TCPListener) Close

func (this *TCPListener) Close() error

func (*TCPListener) KeepAccepting

func (this *TCPListener) KeepAccepting()

func (*TCPListener) Recycle

func (this *TCPListener) Recycle(dest string, conn net.Conn)

Jump to

Keyboard shortcuts

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