Files
softlan-vpn/crates/lanparty-proto/src/lib.rs
T
ddidderr 325e5651a2 feat(proto): validate negotiated datagram budgets
PLAN.md keeps MVP traffic to one Ethernet frame per QUIC datagram with no
fragmentation. The relay already negotiates a datagram budget, but the client
and gateway send paths still relied on Quinn to reject oversized encoded
Ethernet datagrams.

Add a shared protocol validation helper for encoded datagram length versus the
negotiated QUIC budget. Thread the negotiated budget into client and gateway
send boundaries, reject oversized datagrams before send, and count those valid
but unsent frames as local drops.

Document the budget check in the workspace decomposition and gateway behavior.

Test Plan:
- cargo fmt --check
- cargo test -p lanparty-proto -p lanparty-client-core -p lanparty-gateway
- cargo test --workspace
- cargo clippy --workspace --all-targets -- -D warnings
- git diff --check

Refs: PLAN.md
2026-05-21 22:03:15 +02:00

25 lines
843 B
Rust

//! Shared protocol primitives for the LAN party L2 tunnel.
//!
//! This crate intentionally contains no socket, TAP, QUIC, or OS-specific
//! behavior. It is the small contract that the Windows client, Linux gateway,
//! and relay must all agree on.
mod ethernet;
mod mac;
mod mtu;
mod overlay;
pub use ethernet::{
ETHERNET_HEADER_LEN, EthernetFrame, MAX_STANDARD_ETHERNET_FRAME_LEN,
MAX_STANDARD_ETHERNET_PAYLOAD_LEN, MIN_ETHERNET_FRAME_LEN,
};
pub use mac::{MacAddr, MacParseError};
pub use mtu::{
DEFAULT_DATAGRAM_SAFETY_MARGIN, DEFAULT_TAP_MTU, MIN_USEFUL_TAP_MTU, MtuError,
max_tap_mtu_for_datagram, recommended_tap_mtu,
};
pub use overlay::{
FrameType, OVERLAY_HEADER_LEN, OVERLAY_MAGIC, OVERLAY_VERSION, OverlayHeader, OverlayPacket,
ProtoError, decode_datagram, encode_datagram, validate_datagram_budget,
};