tcpwrapper

package module
v1.0.59 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 10 Imported by: 0

README

tcpwrapper

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BUFFERED_SEND_INTERVAL_MS uint = 5
View Source
var EpollAnalysis bool = true
View Source
var EpollWorkerRatio int = 10
View Source
var ErrorLogger func(v ...interface{})
View Source
var GlobalModeBufferSize int = 1024
View Source
var GlobalModeCloseSignal = make(chan struct{})
View Source
var GlobalOnRecv func(source *ConnSession, msg []byte, resolverAsset interface{})
View Source
var GlobalReaderConcurrency int = 256
View Source
var GlobalReaderJobQueueCapacity int = 1024
View Source
var GlobalReaderPool = true
View Source
var GlobalResolveJobQueueCapacity int = 128
View Source
var GlobalResolverAssetNew func() interface{}
View Source
var GlobalResolverConcurrency int = 4
View Source
var InfoLogger func(v ...interface{})
View Source
var LowSpamLogger func(v ...interface{})
View Source
var OnReceiverErrorClosed func(conn *ConnSession)
View Source
var OnReceiverUserClosed func(conn *ConnSession)
View Source
var OnSenderErrorClosed func(conn *ConnSession)
View Source
var OnSenderUserClosed func(conn *ConnSession)
View Source
var RAW_STREAM = false
View Source
var SenderAnalysis bool = true
View Source
var SenderAnalysisSamples int64
View Source
var SpamLogger func(v ...interface{})
View Source
var USE_BIG_ENDIAN = true

Functions

func DefaultReceiverInterruptor added in v1.0.22

func DefaultReceiverInterruptor(session *ConnSession) error

func DefaultSenderInterruptor added in v1.0.22

func DefaultSenderInterruptor(session *ConnSession) error

func Init added in v1.0.51

func Init()

func MakeMessage added in v1.0.15

func MakeMessage(message []byte, workspace []byte)

MakeMessage prepend the length before the message, the workspace must be at least 4 bytes long then the message

func ReadBytesFromConn added in v1.0.27

func ReadBytesFromConn(conn net.Conn, dest []byte) error

func ReadMessageFromConn added in v1.0.27

func ReadMessageFromConn(conn net.Conn, buffer []byte) (uint32, error)

Types

type ConnSession

type ConnSession struct {
	Conn net.Conn
	// contains filtered or unexported fields
}

func (*ConnSession) CheckAnyClose added in v1.0.17

func (conn *ConnSession) CheckAnyClose() (closed bool)

func (*ConnSession) CheckAnyCloseWithTimeout added in v1.0.21

func (conn *ConnSession) CheckAnyCloseWithTimeout(timeout *time.Timer) (closed bool)

func (*ConnSession) ForceClose added in v1.0.24

func (conn *ConnSession) ForceClose()

func (*ConnSession) Init

func (conn *ConnSession) Init()

func (*ConnSession) QueueMessage added in v1.0.25

func (conn *ConnSession) QueueMessage(msg []byte)

func (*ConnSession) ReadBytes added in v1.0.9

func (session *ConnSession) ReadBytes(dest []byte, interruptor interruptorFunc) error

ReadBytes needs a interruptor func to execute between Write() calls.

func (*ConnSession) ReadMessage added in v1.0.9

func (session *ConnSession) ReadMessage(buffer []byte, interruptor interruptorFunc) (uint32, error)

func (*ConnSession) Receiver

func (conn *ConnSession) Receiver(chanSize int, buffered bool, bufferSize int, discardMessage bool)

func (*ConnSession) Remote

func (conn *ConnSession) Remote() string

func (*ConnSession) RequestClose added in v1.0.4

func (conn *ConnSession) RequestClose(safe bool)

func (*ConnSession) SafeRetrieveReceivedMessage added in v1.0.18

func (conn *ConnSession) SafeRetrieveReceivedMessage(blocking bool) (msg []byte, open bool)

func (*ConnSession) SafeRetrieveReceivedMessageWithTimeout added in v1.0.19

func (conn *ConnSession) SafeRetrieveReceivedMessageWithTimeout(timeout *time.Timer) (msg []byte, open bool)

func (*ConnSession) SafeWaitClose added in v1.0.4

func (conn *ConnSession) SafeWaitClose()

func (*ConnSession) Sender

func (conn *ConnSession) Sender(chanSize int, buffered bool, bufferSize int)

Sender opens goroutine to do sending work. Buffered Sender introduce a small interval between network sending tp cache data to send at once. May provide slight more cpu efficiency and cause some delay.

func (*ConnSession) SetupConn

func (conn *ConnSession) SetupConn(c net.Conn)

func (*ConnSession) TryQueueMessage added in v1.0.25

func (conn *ConnSession) TryQueueMessage(msg []byte) bool

func (*ConnSession) WaitAnyClose added in v1.0.4

func (conn *ConnSession) WaitAnyClose()

func (*ConnSession) WaitAnyCloseWithTimeout added in v1.0.21

func (conn *ConnSession) WaitAnyCloseWithTimeout(timeout *time.Timer)

func (*ConnSession) WriteBytes added in v1.0.9

func (session *ConnSession) WriteBytes(message []byte, interruptor interruptorFunc) error

WriteBytes needs a interruptor func to execute between Write() calls.

type SharedEpollReceiver added in v1.0.27

type SharedEpollReceiver struct {
	epoller.Poller

	OnRecv func(source *ConnSession, msg []byte)
	// contains filtered or unexported fields
}

func NewSharedEpollReceiver added in v1.0.27

func NewSharedEpollReceiver(count int, recvChanSize int, bufferSize int, onRecv func(source *ConnSession, msg []byte)) (ew *SharedEpollReceiver, err error)

func (*SharedEpollReceiver) Loop added in v1.0.27

func (ser *SharedEpollReceiver) Loop(onReadErrorAndRemoved func(cs *ConnSession, err error), closeSignal <-chan struct{})

Loop is syncrons, go this.

func (*SharedEpollReceiver) RequestAdd added in v1.0.27

func (ew *SharedEpollReceiver) RequestAdd(cs *ConnSession) bool

func (*SharedEpollReceiver) RequestRemove added in v1.0.27

func (ew *SharedEpollReceiver) RequestRemove(cs *ConnSession, doClose bool) bool

type SharedSender added in v1.0.27

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

func NewSharedSender added in v1.0.27

func NewSharedSender(queueSize int, bufferSize int) *SharedSender

func (*SharedSender) Loop added in v1.0.27

func (ss *SharedSender) Loop(onError func(cs *ConnSession, err error), closeSingalOverwrite <-chan struct{}) (closeSignal <-chan struct{})

func (*SharedSender) PendSend added in v1.0.27

func (ss *SharedSender) PendSend(subject *ConnSession, msg []byte)

Jump to

Keyboard shortcuts

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