connpool

package
v2.4.10-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionInfo = ControlCode(iota)
	Connect
	ConnectOK
	ConnectReject
	Disconnect
	DisconnectOK
	ReadClosed  // deprecated, treat as Disconnect
	WriteClosed // deprecated, treat as Disconnect
	KeepAlive
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BidiStream added in v2.4.3

type BidiStream interface {
	Send(*rpc.ConnMessage) error
	Recv() (*rpc.ConnMessage, error)
}

BidiStream Deprecated

type Control

type Control interface {
	Message
	Code() ControlCode
	SessionInfo() *manager.SessionInfo
	// contains filtered or unexported methods
}

Control is a special message that contains tunnel control information Deprecated

func NewControl

func NewControl(id tunnel.ConnID, code ControlCode, payload []byte) Control

func SessionInfoControl

func SessionInfoControl(sessionInfo *manager.SessionInfo) Control

func SyncRequestControl added in v2.4.3

func SyncRequestControl(ackNbr uint32) Control

func SyncResponseControl added in v2.4.3

func SyncResponseControl(request Control) Control

func VersionControl added in v2.4.3

func VersionControl() Control

type ControlCode

type ControlCode byte

ControlCode designates the type of a Control message Deprecated

func (ControlCode) String

func (c ControlCode) String() string

type Handler

type Handler interface {
	tunnel.Handler

	HandleMessage(ctx context.Context, message Message)
}

Handler for the MuxTunnel Deprecated

func HandlerFromConn

func HandlerFromConn(connID tunnel.ConnID, muxTunnel MuxTunnel, release func(), conn net.Conn) Handler

HandlerFromConn is like NewHandler but initializes the handler with an already existing connection. Deprecated

func NewDialer

func NewDialer(connID tunnel.ConnID, muxTunnel MuxTunnel, release func()) Handler

NewDialer creates a new handler that dispatches messages in both directions between the given gRPC server and the destination identified by the given connID.

The handler remains active until it's been idle for idleDuration, at which time it will automatically close and call the release function it got from the connpool.Pool to ensure that it gets properly released. Deprecated

type Message

type Message interface {
	ID() tunnel.ConnID
	Payload() []byte
	TunnelMessage() *manager.ConnMessage
}

Message a message on the multiplexed tunnel Deprecated

func FromConnMessage

func FromConnMessage(cm *manager.ConnMessage) Message

FromConnMessage Deprecated

func NewMessage

func NewMessage(id tunnel.ConnID, payload []byte) Message

NewMessage Deprecated

type MuxTunnel added in v2.4.5

type MuxTunnel interface {
	DialLoop(ctx context.Context, pool *tunnel.Pool) error
	ReadLoop(ctx context.Context) (<-chan Message, <-chan error)
	Send(context.Context, Message) error
	Receive(context.Context) (Message, error)
	CloseSend() error
	ReadPeerVersion(context.Context) (uint16, error)
}

The MuxTunnel interface represents a bidirectional, synchronized, multiplexed connection tunnel that sends TCP or UDP traffic over gRPC using manager.ConnMessage messages.

A MuxTunnel connection is closed by one of six things happening at either end (or at both ends).

  1. Read from local connection fails (typically EOF)
  2. Write to local connection fails (connection peer closed)
  3. Idle timer timed out.
  4. Context is cancelled.
  5. Disconnect request received from MuxTunnel peer.
  6. DisconnectOK received from MuxTunnel peer.

When #1 or #2 happens, the MuxTunnel will send a Disconnect request to its MuxTunnel peer, shorten the Idle timer, and then continue to serve incoming data from the tunnel peer until a DisconnectOK is received. Once that happens, it's guaranteed that the tunnel peer will send no more messages and the connection is closed.

When #3, #4, or #5 happens, the MuxTunnel will send a DisconnectOK to its tunnel peer and close the connection.

When #6 happens, the MuxTunnel will simply close. Deprecated

func NewMuxTunnel added in v2.4.5

func NewMuxTunnel(stream BidiStream) MuxTunnel

Jump to

Keyboard shortcuts

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