Expand description
ant-quic: QUIC transport protocol with advanced NAT traversal for P2P networks
This library provides a clean, modular implementation of QUIC-native NAT traversal using raw public keys for authentication. It is designed to be minimal, focused, and highly testable, with exceptional cross-platform support.
The library is organized into the following main modules:
transport: Core QUIC transport functionalitynat_traversal: QUIC-native NAT traversal protocoldiscovery: Platform-specific network interface discoverycrypto: Raw public key authenticationtrust: Trust management with TOFU pinning and channel binding
Re-exports§
pub use high_level::Accept;pub use high_level::Connecting;pub use high_level::Connection as HighLevelConnection;pub use high_level::Endpoint;pub use high_level::RecvStream as HighLevelRecvStream;pub use high_level::SendStream as HighLevelSendStream;pub use link_transport::BoxFuture;pub use link_transport::BoxStream;pub use link_transport::Capabilities;pub use link_transport::ConnectionStats as LinkConnectionStats;pub use link_transport::DisconnectReason as LinkDisconnectReason;pub use link_transport::Incoming as LinkIncoming;pub use link_transport::LinkConn;pub use link_transport::LinkError;pub use link_transport::LinkEvent;pub use link_transport::LinkRecvStream;pub use link_transport::LinkResult;pub use link_transport::LinkSendStream;pub use link_transport::LinkTransport;pub use link_transport::NatHint;pub use link_transport::ProtocolId;pub use crypto::raw_public_keys::key_utils::ML_DSA_65_PUBLIC_KEY_SIZE;pub use crypto::raw_public_keys::key_utils::ML_DSA_65_SECRET_KEY_SIZE;pub use crypto::raw_public_keys::key_utils::MlDsaPublicKey;pub use crypto::raw_public_keys::key_utils::MlDsaSecretKey;pub use crypto::raw_public_keys::key_utils::derive_peer_id_from_key_bytes;pub use crypto::raw_public_keys::key_utils::derive_peer_id_from_public_key;pub use crypto::raw_public_keys::key_utils::generate_ml_dsa_keypair;pub use crypto::raw_public_keys::key_utils::verify_peer_id;pub use candidate_discovery::CandidateDiscoveryManager;pub use candidate_discovery::DiscoveryConfig;pub use candidate_discovery::DiscoveryError;pub use candidate_discovery::DiscoveryEvent;pub use candidate_discovery::NetworkInterface;pub use candidate_discovery::ValidatedCandidate;pub use connection::Chunk;pub use connection::Chunks;pub use connection::ClosedStream;pub use connection::Connection;pub use connection::ConnectionError;pub use connection::ConnectionStats;pub use connection::Datagrams;pub use connection::Event;pub use connection::FinishError;pub use connection::ReadError;pub use connection::ReadableError;pub use connection::RecvStream;pub use connection::SendDatagramError;pub use connection::SendStream;pub use connection::StreamEvent;pub use connection::Streams;pub use connection::WriteError;pub use connection::Written;pub use endpoint::AcceptError;pub use endpoint::ConnectError;pub use endpoint::ConnectionHandle;pub use endpoint::DatagramEvent;pub use endpoint::Endpoint as LowLevelEndpoint;pub use endpoint::Incoming;pub use nat_traversal_api::BootstrapNode;pub use nat_traversal_api::CandidateAddress;pub use nat_traversal_api::NatTraversalConfig;pub use nat_traversal_api::NatTraversalEndpoint;pub use nat_traversal_api::NatTraversalError;pub use nat_traversal_api::NatTraversalEvent;pub use nat_traversal_api::NatTraversalStatistics;pub use nat_traversal_api::PeerId;pub use node::Node;pub use node::NodeError;pub use node_config::NodeConfig;pub use node_config::NodeConfigBuilder;pub use node_status::NatType;pub use node_status::NodeStatus;pub use node_event::DisconnectReason as NodeDisconnectReason;pub use node_event::NodeEvent;pub use node_event::TraversalMethod;pub use p2p_endpoint::ConnectionMetrics;pub use p2p_endpoint::DisconnectReason;pub use p2p_endpoint::EndpointError;pub use p2p_endpoint::EndpointStats;pub use p2p_endpoint::P2pEndpoint;pub use p2p_endpoint::P2pEvent;pub use p2p_endpoint::PeerConnection;pub use p2p_endpoint::TraversalPhase;pub use unified_config::ConfigError;pub use unified_config::MtuConfig;pub use unified_config::NatConfig;pub use unified_config::P2pConfig;pub use unified_config::P2pConfigBuilder;pub use relay::AuthToken;pub use relay::RelayAction;pub use relay::RelayAuthenticator;pub use relay::RelayConnection;pub use relay::RelayConnectionConfig;pub use relay::RelayError;pub use relay::RelayEvent;pub use relay::RelayResult;pub use relay::SessionId;pub use relay::SessionManager;pub use relay::SessionState;pub use shared::ConnectionId;pub use shared::EcnCodepoint;pub use shared::EndpointEvent;pub use transport_error::Code as TransportErrorCode;pub use transport_error::Error as TransportError;pub use cid_generator::RandomConnectionIdGenerator;pub use config::AckFrequencyConfig;pub use config::ClientConfig;pub use config::EndpointConfig;pub use config::MtuDiscoveryConfig;pub use config::ServerConfig;pub use config::TransportConfig;pub use crypto::pqc::MlDsa65;pub use crypto::pqc::MlKem768;pub use crypto::pqc::PqcConfig;pub use crypto::pqc::PqcConfigBuilder;pub use crypto::pqc::PqcError;pub use crypto::pqc::PqcResult;
Modules§
- bounded_
pending_ buffer - Bounded pending data buffer with TTL expiration Bounded pending data buffer with TTL expiration
- candidate_
discovery - Network candidate discovery and management Candidate Discovery System for QUIC NAT Traversal
- chat
- Secure chat protocol implementation Chat protocol implementation for QUIC streams
- cid_
generator - Connection ID generation strategies
- coding
- Coding related traits.
- compliance_
validator - IETF compliance validation tools
- config
- Configuration structures and validation
- connection
- QUIC connection state machine and management
- crypto
- Cryptographic operations and raw public key support Traits and implementations for the QUIC cryptography protocol
- discovery
- Platform-specific network interface discovery Network Interface Discovery
- discovery_
trait - Discovery trait for stream composition Discovery trait for stream composition
- endpoint
- QUIC endpoint for accepting and initiating connections
- fair_
polling - Fair polling for multiple transports Fair polling for multiple transports
- frame
- QUIC frame types and encoding/decoding
- high_
level - High-level async API for QUIC
- link_
transport - Link Transport Abstraction Layer
- logging
- Structured logging and diagnostics
- masque
- MASQUE CONNECT-UDP Bind protocol for fully connectable P2P nodes MASQUE CONNECT-UDP Bind Protocol Implementation
- metrics
- Metrics collection and export system (basic metrics always available) Metrics collection and export system
- nat_
traversal - NAT traversal protocol implementation NAT Traversal Protocol Implementation
- nat_
traversal_ api - High-level NAT traversal API High-level NAT Traversal API for Autonomi P2P Networks
- node
- Zero-configuration P2P node - THE PRIMARY API
- node_
config - Minimal configuration for zero-config P2P nodes Minimal configuration for zero-config P2P nodes
- node_
event - Unified events for P2P nodes Unified events for P2P nodes
- node_
status - Consolidated node status for observability Consolidated node status for observability
- p2p_
endpoint - P2P endpoint - the primary API for ant-quic
- packet
- QUIC packet structures and processing
- path_
selection - RTT-based path selection with hysteresis RTT-based path selection with hysteresis
- relay
- TURN-style relay protocol for NAT traversal fallback TURN-style Relay Protocol Implementation
- shared
- Shared types and utilities
- shutdown
- Coordinated shutdown for endpoints Coordinated shutdown for ant-quic endpoints
- stats_
dashboard - Real-time statistics dashboard Connection Statistics Dashboard
- structured_
events - Structured event logging for observability Structured event logging for observability
- terminal_
ui - Terminal user interface components Terminal UI formatting and display helpers for ant-quic
- token_
v2 - Address-validation tokens bound to (PeerId||CID||nonce) Token v2: bind address-validation tokens to (PeerId || CID || nonce).
- tracing
- Zero-cost tracing and event logging system Zero-cost tracing system for P2P network debugging
- transport
- Transport-level protocol implementation Core QUIC transport layer
- transport_
error - Transport error types and codes
- transport_
parameters - QUIC connection transport parameters
- transport_
resilience - Graceful transport degradation Graceful transport degradation
- trust
- Transport trust module (TOFU, rotations, channel binding surfaces)
- unified_
config - P2P configuration system
- watchable
- Watchable state pattern for reactive observation Watchable state pattern
Macros§
- if_
trace - Conditional code block that only compiles with trace feature
- log_
event - Convenience macros for logging structured events
- poll_
transports_ fair - Macro to poll transports in fair order
- trace_
candidate_ discovered - Trace a NAT traversal candidate discovered
- trace_
conn_ established - Trace a connection established event
- trace_
event - Primary trace event macro - compiles to nothing when disabled
- trace_
hole_ punching_ started - Trace hole punching started
- trace_
observed_ address_ received - Trace an observed address received
- trace_
observed_ address_ sent - Trace an observed address event
- trace_
packet_ received - Trace a packet received event
- trace_
packet_ sent - Trace a packet sent event
- trace_
stream_ opened - Trace a stream opened event
Structs§
- P2pLink
Conn - A
LinkConnimplementation wrapping a high-level QUIC connection. - P2pLink
Transport - A
LinkTransportimplementation wrappingP2pEndpoint. - P2pRecv
Stream - A
LinkRecvStreamimplementation wrapping a high-level receive stream. - P2pSend
Stream - A
LinkSendStreamimplementation wrapping a high-level send stream. - Stream
Id - Identifier for a stream within a particular connection
- Transmit
- An outgoing packet
- VarInt
- An integer less than 2^62
- VarInt
Bounds Exceeded - Error returned when constructing a
VarIntfrom a value >= 2^62
Enums§
- Candidate
Source - How an address candidate was discovered
- Candidate
State - Current state of a candidate address
- Dir
- Whether a stream communicates data in both directions or only from the initiator
- Side
- Whether an endpoint was the initiator of a connection
Constants§
- DEFAULT_
SUPPORTED_ VERSIONS - The QUIC protocol version implemented.
Traits§
- Token
Store - Responsible for storing validation tokens received from servers and retrieving them for use in subsequent connections