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:
Generated
+1
@@ -263,6 +263,7 @@ name = "aura-transport"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"async-trait",
|
||||||
"aura-crypto",
|
"aura-crypto",
|
||||||
"aura-proto",
|
"aura-proto",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ tracing = "0.1"
|
|||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
|
async-trait = "0.1"
|
||||||
|
|
||||||
# Dev / bench
|
# Dev / bench
|
||||||
criterion = "0.5"
|
criterion = "0.5"
|
||||||
|
|||||||
@@ -17,3 +17,4 @@ rand.workspace = true
|
|||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
async-trait.workspace = true
|
||||||
|
|||||||
@@ -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>>;
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user