Filament
Packets and Links
Packets and links in Filament — packet variants, link state machines, and per-link delivery semantics.
Purpose
Experimental transport/runtime stack composed from filament core, crypto, link, packet, transport, types, interfaces, and utilities.
This page follows the real source shape for Filament and explains the workflow a developer is likely to use first.
Developer workflow
Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.
Primary types to know
Announce— filament/filament-transport/src/announce.rsAnnounceManager— filament/filament-transport/src/announce.rsAnnounceQueue— filament/filament-transport/src/announce.rsAutoInterface— filament/filament-interfaces/src/auto.rsAutoInterfaceBuilder— filament/filament-interfaces/src/auto.rsAutoInterfaceConfig— filament/filament-interfaces/src/auto.rsBandwidthManager— filament/filament-transport/src/bandwidth.rsChannel— filament/filament-link/src/channel.rsChannelMessage— filament/filament-link/src/channel.rsConfig— filament/filament-core/src/config.rsDestinationHash— filament/filament-transport/src/types.rsDestinationHash— filament/filament-types/src/primitives.rs
Example shape
use filament_link::{Identity, Link, LinkOptions, LinkState};
use filament_packet::{Header, Packet, PacketValidator};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Build a Packet via its Header. The PacketValidator enforces version,
// length, and HMAC invariants the routing engine relies on.
let header = Header::new_data();
let packet = Packet::new(header, b"payload".to_vec());
let validator = PacketValidator::default();
validator.validate(&packet)?;
// Open a Link to a destination identity. The session moves through
// Pending -> Active -> Closed states as the proof exchange completes.
let local = Identity::generate();
let remote = Identity::generate();
let link = Link::open(local, remote.address(), LinkOptions::default()).await?;
println!(
"packet_ok=true link_id={} state={:?}",
link.id(),
link.state(),
);
let _ = LinkState::Active;
Ok(())
}