| Crates.io | nwd1-quic |
| lib.rs | nwd1-quic |
| version | 0.1.0 |
| created_at | 2025-10-28 05:20:56.603046+00 |
| updated_at | 2025-10-28 05:20:56.603046+00 |
| description | QUIC transport for nwd1 binary frames. |
| homepage | |
| repository | https://github.com/iadev09/nwd1-quic |
| max_upload_size | |
| id | 1904197 |
| size | 36,290 |
QUIC transport for nwd1 binary frames.
nwd1-quic provides async helpers to send and receive nwd1 frames over QUIC streams, using the quinn library.
It integrates seamlessly with netid64 identifiers and uses Tokio runtime.
Each frame follows the nwd1 binary format:
MAGIC (4B) | LEN (4B) | ID (8B) | KIND (1B) | VER (8B) | PAYLOAD (variable)
MAGIC: constant b"NWD1" headerLEN: total byte length following header (u32, BE)ID: 64-bit network ID (netid64)KIND: frame type discriminatorVER: protocol versionPAYLOAD: binary application datause nwd1_quic::{send_frame, recv_frame};
use nwd1::Frame;
use netid64::NetId64;
use bytes::Bytes;
use quinn::{RecvStream, SendStream};
async fn example(mut send: SendStream, mut recv: RecvStream) -> anyhow::Result<()> {
let frame = Frame {
id: NetId64::make(1, 7, 42),
kind: 1,
ver: 1,
payload: Bytes::from_static(b"hello"),
};
// Send frame
send_frame(&mut send, &frame).await?;
// Receive frame
if let Some(received) = recv_frame(&mut recv).await? {
assert_eq!(received.id.raw(), frame.id.raw());
}
Ok(())
}
tokio + quinnread_exact_opt() helper for compact error handlingMAGIC early to avoid wasteful allocationsMAX_FRAME_LEN = 8 MiB) for safetyLicensed under either of:
at your option.