ferrotunnel-protocol 1.0.6

Wire protocol for FerroTunnel reverse tunnel
Documentation

ferrotunnel-protocol

Crates.io Documentation

Wire protocol definitions and codec for FerroTunnel.

Overview

This crate defines the binary protocol used for tunnel communication:

  • 12 frame types for control, data, and keepalive
  • Length-prefixed codec (4-byte length + 1-byte type) with bincode control frames
  • 16MB max frame size with validation

Frame Types

Control Frames

  • Handshake / HandshakeAck - Connection establishment
  • Register / RegisterAck - Tunnel registration

Stream Frames

  • OpenStream / StreamAck - Stream creation
  • Data - Payload transfer
  • CloseStream - Stream termination

Keepalive

  • Heartbeat / HeartbeatAck - Connection health

Other

  • Error - Error reporting
  • PluginData - Plugin communication

Usage

use ferrotunnel_protocol::{Frame, TunnelCodec};
use tokio_util::codec::{Framed, Decoder};

// Create a codec for framing
let codec = TunnelCodec::new();

// Create frames
let frame = Frame::Heartbeat { 
    timestamp: 1234567890 
};

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.