chore(workspace): scaffold net crate for QUIC transport

This commit is contained in:
Serkyo 2026-07-12 00:28:45 +02:00
parent 858200b58f
commit f0d2269e8f
7 changed files with 762 additions and 8 deletions

716
Cargo.lock generated

File diff suppressed because it is too large Load diff

22
crates/net/Cargo.toml Normal file
View file

@ -0,0 +1,22 @@
[package]
name = "net"
license.workspace = true
license-file.workspace = true
authors.workspace = true
edition.workspace = true
version.workspace = true
[dependencies]
crossbeam-channel = "0.5.16"
postcard.workspace = true
quinn = "0.11.11"
rcgen = "0.14.8"
rustls = "0.23.41"
serde.workspace = true
thiserror.workspace = true
tokio = { version = "1.52.3", features = ["rt-multi-thread", "macros", "net", "sync", "io-util", "time"] }
tracing.workspace = true
shared = { path = "../shared" }
[lints]
workspace = true

5
crates/net/src/codec.rs Normal file
View file

@ -0,0 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
//! Length-prefixed `postcard` frame codec.
//!
//! Encodes and decodes one logical protocol message per record on a QUIC stream, using a length prefix so a reader can recover record boundaries from a byte stream. Populated in a later concept; currently a placeholder.

View file

@ -0,0 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
//! QUIC endpoint construction for client and server.
//!
//! Builds the `quinn` endpoints and configures ALPN and TLS 1.3 (self-signed server certificate, permissive client verifier for the initial milestone). Populated in a later concept; currently a placeholder.

View file

@ -0,0 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
//! Synvael application handshake over an established QUIC connection.
//!
//! Drives the `ClientHello` -> `HandshakeAck` / `HandshakeReject` exchange and protocol-version verification on the control stream. Populated in a later concept; currently a placeholder.

12
crates/net/src/lib.rs Normal file
View file

@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
//! QUIC transport, connection lifecycle, and wire framing for the Synvael client-server protocol.
//!
//! This crate owns the asynchronous runtime and the transport dependencies, keeping them out of the lean `shared` protocol crate. Protocol message types live in `shared`; this crate is responsible only for carrying them over the wire.
//!
//! The synchronous simulation loop (`server`) and windowing loop (`client`) never touch the async runtime directly. They exchange messages with the network over channels, so the async runtime stays confined to this crate.
pub mod codec;
pub mod endpoint;
pub mod handshake;
pub mod runtime;

View file

@ -0,0 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
//! Threaded `tokio` runtime bridge between the async network and the synchronous simulation.
//!
//! Owns the runtime thread and the channels that carry inbound and outbound messages across the async-sync boundary, keeping the async runtime confined to this crate. Populated in a later concept; currently a placeholder.