Skip to main content

Module data_channel

Module data_channel 

Source
Expand description

数据通道协议 — 握手、确认、双向 pipe。

提供客户端和服务端两端的数据通道握手函数, 以及双向 TCP 数据转发(pipe)功能。

Enums§

HandshakeError
数据通道握手错误。
SignalKind
信号通道消息类型。

Functions§

client_handshake
客户端发起握手:发送 [token: u64 BE][tunnel_type: u8] 并等待服务端确认。
pipe_bidirectional
双向 pipe 两个 TCP stream,任一方断开即结束。
read_signal
从信号通道读取一个信号(1 字节)。
send_notification
向信号通道发送“新外部连接“通知(1 字节 SIGNAL_NEW_CONN)。
server_accept
服务端发送握手成功响应(1 字节 STATUS_OK)。
server_receive_handshake
服务端接收并解析客户端握手,返回 (token, tunnel_type)
server_reject
服务端发送握手拒绝响应:[STATUS_ERR][err_len: u16 BE][reason]