feat(transport): pin PacketConnection contract for the router seam

Define the async PacketConnection trait (send_packet/recv_packet over &self)
that aura-tunnel's router consumes and the QUIC connection will implement.
Committed before Wave 3 so the transport and tunnel agents build against a
stable cross-crate contract from isolated worktrees.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xah30
2026-05-25 18:10:17 +03:00
parent 5d88d57223
commit cb78de4f37
5 changed files with 32 additions and 1 deletions
Generated
+1
View File
@@ -263,6 +263,7 @@ name = "aura-transport"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"aura-crypto",
"aura-proto",
"bytes",
+1
View File
@@ -77,6 +77,7 @@ tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
anyhow = "1"
thiserror = "1"
async-trait = "0.1"
# Dev / bench
criterion = "0.5"
+1
View File
@@ -17,3 +17,4 @@ rand.workspace = true
tracing.workspace = true
thiserror.workspace = true
anyhow.workspace = true
async-trait.workspace = true
+20
View File
@@ -0,0 +1,20 @@
//! The transport's full-duplex packet-connection abstraction.
//!
//! [`PacketConnection`] is the seam between this crate (QUIC transport + the post-handshake
//! `aura_proto::Session`) and `aura-tunnel`'s router. The router reads IP packets from the TUN
//! device and `send_packet`s the ones routed through the VPN, while a second task `recv_packet`s
//! decrypted IP packets to write back to the TUN. The methods take `&self` (not `&mut self`) so a
//! single connection can be shared — e.g. behind `Arc<dyn PacketConnection>` — across the
//! concurrent send and receive tasks.
use async_trait::async_trait;
/// A bidirectional, encrypted packet pipe to the peer (one IP packet per call).
#[async_trait]
pub trait PacketConnection: Send + Sync {
/// Encrypt and send one IP packet to the peer.
async fn send_packet(&self, packet: &[u8]) -> anyhow::Result<()>;
/// Receive and decrypt one IP packet from the peer. Returns the plaintext IP packet.
async fn recv_packet(&self) -> anyhow::Result<Vec<u8>>;
}
+9 -1
View File
@@ -1 +1,9 @@
//! aura-transport — QUIC transport and traffic mimicry (skeleton; implemented in Wave 3).
//! aura-transport — QUIC transport, HTTPS/H3 traffic mimicry, and the packet-connection seam.
//!
//! Implemented in Wave 3. This file currently pins the cross-crate [`PacketConnection`] contract
//! consumed by `aura-tunnel`'s router; the QUIC endpoint (quinn), mimicry, and padding land
//! alongside it in the `quic`, `mimicry`, and `padding` modules.
pub mod conn;
pub use conn::PacketConnection;