Documentation ¶
Index ¶
Constants ¶
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 SyncResponseControl ¶ added in v2.4.3
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 ¶
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 ¶
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
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).
- Read from local connection fails (typically EOF)
- Write to local connection fails (connection peer closed)
- Idle timer timed out.
- Context is cancelled.
- Disconnect request received from MuxTunnel peer.
- 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