connection

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderedRecvQueueSize    = 24        // OrderedRecvQueue channel cap
	RecvQueueSize           = 24        // RecvQueue channel cap
	OutboundRecvBuffer      = 16 * 1024 // 16K receive buffer for Outbound Connection
	OutboundBlockTimeoutSec = 3         // Wait the period and check exit signal
	PacketWaitTimeoutSec    = 7         // If block processor is waiting for a "hole", and no packet comes within this limit, the Connection will be closed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteRingBuffer

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

func NewByteRingBuffer

func NewByteRingBuffer(size uint32) ByteRingBuffer

func (*ByteRingBuffer) Empty

func (rb *ByteRingBuffer) Empty() bool

func (*ByteRingBuffer) OverWrite

func (rb *ByteRingBuffer) OverWrite(data []byte)

func (*ByteRingBuffer) Read

func (rb *ByteRingBuffer) Read(data []byte) int

type CloseRead added in v1.0.7

type CloseRead interface {
	CloseRead() error
}

type CloseWrite added in v1.0.7

type CloseWrite interface {
	CloseWrite() error
}

type Connection

type Connection interface {
	HalfOpenConn
	GetConnectionID() uint32

	RecvBlock(block.Block)

	SendConnect(address string)
	SendDisconnect(uint8)

	OrderedRelay(connection Connection) // Run orderedRelay infinitely
	Stop()                              // Stop all related relay and remove itself from connectionPool
	// contains filtered or unexported methods
}

func NewInboundConnection

func NewInboundConnection(sendQueue chan<- block.Block, ctx context.Context, removeFromPool context.CancelFunc) Connection

func NewOutboundConnection

func NewOutboundConnection(connectionID uint32, sendQueue chan<- block.Block, ctx context.Context, removeFromPool context.CancelFunc) Connection

type HalfOpenConn added in v1.0.7

type HalfOpenConn interface {
	net.Conn
	CloseRead() error
	CloseWrite() error
}

type InboundConnection

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

func (*InboundConnection) Close

func (c *InboundConnection) Close() error

func (*InboundConnection) CloseRead added in v1.0.7

func (c *InboundConnection) CloseRead() error

func (*InboundConnection) CloseWrite added in v1.0.7

func (c *InboundConnection) CloseWrite() error

func (*InboundConnection) GetConnectionID

func (bc *InboundConnection) GetConnectionID() uint32

func (*InboundConnection) LocalAddr

func (c *InboundConnection) LocalAddr() net.Addr

func (*InboundConnection) OrderedRelay

func (bc *InboundConnection) OrderedRelay(connection Connection)

func (*InboundConnection) Read

func (c *InboundConnection) Read(b []byte) (n int, err error)

func (*InboundConnection) RecvBlock

func (bc *InboundConnection) RecvBlock(blk block.Block)

func (*InboundConnection) RemoteAddr

func (c *InboundConnection) RemoteAddr() net.Addr

func (*InboundConnection) SendConnect

func (bc *InboundConnection) SendConnect(address string)

func (*InboundConnection) SendDisconnect

func (bc *InboundConnection) SendDisconnect(shutdownType uint8)

func (*InboundConnection) SetDeadline

func (c *InboundConnection) SetDeadline(t time.Time) error

func (*InboundConnection) SetReadDeadline

func (c *InboundConnection) SetReadDeadline(t time.Time) error

func (*InboundConnection) SetWriteDeadline

func (c *InboundConnection) SetWriteDeadline(t time.Time) error

func (*InboundConnection) Stop

func (bc *InboundConnection) Stop()

func (*InboundConnection) Write

func (c *InboundConnection) Write(b []byte) (n int, err error)

type OutboundConnection

type OutboundConnection struct {
	HalfOpenConn
	// contains filtered or unexported fields
}

func (*OutboundConnection) GetConnectionID

func (bc *OutboundConnection) GetConnectionID() uint32

func (*OutboundConnection) OrderedRelay

func (bc *OutboundConnection) OrderedRelay(connection Connection)

func (*OutboundConnection) RecvBlock

func (oc *OutboundConnection) RecvBlock(blk block.Block)

func (*OutboundConnection) RecvRelay

func (oc *OutboundConnection) RecvRelay()

real connection -> ConnectionPool's SendQueue -> TunnelPool

func (*OutboundConnection) SendConnect

func (bc *OutboundConnection) SendConnect(address string)

func (*OutboundConnection) SendDisconnect

func (bc *OutboundConnection) SendDisconnect(shutdownType uint8)

func (*OutboundConnection) SendRelay

func (oc *OutboundConnection) SendRelay()

orderedRecvQueue -> real connection

func (*OutboundConnection) Stop

func (bc *OutboundConnection) Stop()

Jump to

Keyboard shortcuts

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