Expand description
数据通道协议 — 握手、确认、双向 pipe。
提供客户端和服务端两端的数据通道握手函数, 以及双向 TCP 数据转发(pipe)功能。
Enums§
- Handshake
Error - 数据通道握手错误。
- Signal
Kind - 信号通道消息类型。
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]。