Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTCPClientSettings = TCPClientConfiguration{ Timeout: time.Second * 3, Deadline: time.Millisecond * 200, FlushBufferTimoutMs: 500, PollInterval: time.Second * 60, SessionAfterFirstByte: true, SessionInitationTimeout: time.Second * 0, SourceIP: "", }
View Source
var DefaultTCPServerSettings = TCPServerConfiguration{ Timeout: time.Second * 3, Deadline: time.Millisecond * 200, FlushBufferTimoutMs: 500, PollInterval: time.Second * 60, SessionAfterFirstByte: true, SessionInitiationTimeout: time.Second * 30, }
Functions ¶
This section is empty.
Types ¶
type BufferedConn ¶
type BufferedConn struct {
net.Conn // So that most methods are embedded
// contains filtered or unexported fields
}
-------------------------------------------------------------------------------------------- BufferedConn wrapping the net.Conn yet compatible for better reading performance and a peek preview. --------------------------------------------------------------------------------------------
func (BufferedConn) FirstByteOrError ¶
func (b BufferedConn) FirstByteOrError(howLong time.Duration) error
type ConnectionAndSessionInstance ¶
type ConnectionAndSessionInstance interface {
Connect() error
ConnectionInstance
Session
}
func CreateNewTCPClient ¶
func CreateNewTCPClient(hostname string, port int, lowLevelProtocol protocol.Implementation, proxy ConnectionType, timing ...TCPClientConfiguration) ConnectionAndSessionInstance
type ConnectionInstance ¶
type ConnectionInstance interface {
// Send data directly from instance. This will not work if the instance
Send(data [][]byte) (int, error)
//Receive data directly from instance. This will not work if the instance handles many connections like TCP-Servers
Receive() ([]byte, error)
// Run - Main-Loop
Run(handler Handler)
// Stop the main-loop of the Run-handler
Stop()
// Retrieve a session by IP. Do not use this for a normal protocol conversion of a server... Can return nil
FindSessionsByIp(ip string) []Session
// Wait until the server is ready for connections. Useful at startup. Returns true when the server is ready
WaitReady() bool
}
func CreateNewTCPServerInstance ¶
func CreateNewTCPServerInstance(listeningPort int, protocolReceiveve protocol.Implementation, connectionType ConnectionType, maxConnections int, timingConfigs ...TCPServerConfiguration) ConnectionInstance
type ConnectionType ¶
type ConnectionType int
const ( NoLoadBalancer ConnectionType = 1 HAProxySendProxyV2 ConnectionType = 2 )
type ErrorType ¶
type ErrorType int
const ( ErrorConnect ErrorType = 1 ErrorSend ErrorType = 2 ErrorReceive ErrorType = 3 ErrorDisconnect ErrorType = 4 ErrorInternal ErrorType = 5 ErrorConnectionLimit ErrorType = 6 ErrorAccept ErrorType = 7 // error for Server ErrorMaxConnections ErrorType = 8 ErrorCreateSession ErrorType = 9 // server only ErrorConfiguration ErrorType = 10 // Error in configuration ErrorLogin ErrorType = 11 )
type FileNameGeneration ¶
type FileNameGeneration int
const ( Default FileNameGeneration = 1 TimeStamp FileNameGeneration = 1 )
type Handler ¶
type Handler interface {
//DataReceived event is triggered whenever the underlying protocol delivered a complete block(file/transmission) of data
DataReceived(session Session, data []byte, receiveTimestamp time.Time) error
// Connected event is triggered when connection is established. For client as well as for servers. For clients in addition every time the connection had
// to be reestablished. If this method returns anything other but null, the connections
// is declined and the thread ends
Connected(session Session) error
// Disconnected event is triggered when connection
// is terminated.
//For Servers: when the client ends the session
// For clients: when the only client connection ends (inc.eof)
Disconnected(session Session)
// Error is called from async process (Run) when
// status messages regarding the connection is available
Error(session Session, typeOfError ErrorType, err error)
}
type ReadFilePolicy ¶
type ReadFilePolicy int
const ( ReadAndLeaveFile ReadFilePolicy = 1 DeleteWhenRead ReadFilePolicy = 2 RenameWhenRead ReadFilePolicy = 3 )
type SecureConnectionOptions ¶
type SecureConnectionOptions struct {
PublicKey string
}
type TCPClientConfiguration ¶
type TCPClientConfiguration struct {
Timeout time.Duration
Deadline time.Duration
FlushBufferTimoutMs int
PollInterval time.Duration
SessionAfterFirstByte bool
SessionInitationTimeout time.Duration
SourceIP string
}
func (TCPClientConfiguration) SetSourceIP ¶
func (s TCPClientConfiguration) SetSourceIP(sourceIP string) TCPClientConfiguration
Click to show internal directories.
Click to hide internal directories.