ant-quic
A QUIC transport protocol implementation with advanced NAT traversal capabilities, optimized for P2P networks and the Autonomi ecosystem.


📚 Documentation
Comprehensive documentation is available in the docs/
directory:
Features
- Advanced NAT Traversal: ICE-like candidate discovery and coordinated hole punching
- P2P Optimized: Designed for peer-to-peer networks with minimal infrastructure
- High Connectivity: Near 100% connection success rate through sophisticated NAT handling
- QUIC Address Discovery: Automatic peer address detection via IETF draft standard
- Post-Quantum Ready: Support for ML-KEM-768 and ML-DSA-65 hybrid cryptography
- IPv4/IPv6 Dual Stack: Full support for both protocols with automatic selection
- Security-Hardened: Protocol obfuscation, robust error handling, and panic-free operation
- Built on Quinn: Leverages the proven Quinn QUIC implementation as foundation
- Automatic Bootstrap Connection: Nodes automatically connect to configured bootstrap nodes
- Production-Ready Binary: Full-featured
ant-quic
binary for immediate deployment
Transport Trust Model
This project treats transport identity as a minimal, safe substrate. We adopt a TOFU (Trust On First Use) baseline at the transport, and let higher layers decide “who this machine is” and what it’s allowed to do. The split keeps the transport simple while enabling strong, decentralized trust above it.
- Identity and pinning
- PeerId = H(SPKI) where SPKI is the peer’s SubjectPublicKeyInfo (Ed25519 today; ML‑DSA planned).
- First contact: TOFU stores SPKI fingerprint keyed by PeerId. No IP/port pinning.
- Rotation: require continuity signature (new_key signed by old_key); otherwise reject.
- Channel binding
- After TLS 1.3 + ML‑KEM handshake, both peers sign a TLS exporter with ML‑DSA/Ed25519; verify against pin. If mismatch, drop.
- NAT/path changes
- Bind address‑validation tokens to (PeerId || CID || nonce), not the 4‑tuple. Treat OBSERVED_ADDRESS as hints only.
- Surfaces/hooks
- PinStore trait + default FS backend (append‑only rotations).
- Events: OnFirstSeenPeer(peer_id, spki_fpr), OnRotation(old_fpr, new_fpr), OnBindingVerified(peer_id).
- Policy gates: config to allow/deny TOFU, require continuity, or delegate to upper‑layer callback.
Upper Trust Layers (out of transport scope)
- Claims/attestations: optional device attestations included in an “identity descriptor”. Transport passes through; upper layer interprets.
- Endorsements: N‑of‑M introducers can co‑sign descriptors/rotations to reduce TOFU risk without centralizing trust.
- Transparency: append‑only, replicated log of identity updates (rotations, endorsements). Clients check STH consistency.
- Enrollment/privileges: unknown peers get minimal capabilities until trust elevates; suspicious rotations are quarantined.
Operational Policies
- Key storage: ML‑DSA secret in enclave/TPM if available; sealed backup; continuity process documented.
- Rotation cadence: rare; continuity‑signed; temporary {Kold, Knew} overlap.
- Revocation: gossip revocation records in transparency feed; transport enforces on connect.
Roadmap
Near‑term (transport changes)
- Implement PinStore + default FS backend; persistence of SPKI pins and rotations.
- ML‑DSA/Ed25519 channel binding using TLS exporter; drop on mismatch; emit events.
- Address‑validation token binding to (PeerId || CID || nonce) and treat observed‑address as hints.
- Events and PolicyCallback with config flags: allow_tofu (default on), require_continuity (default on), enable_channel_binding (default on).
Mid‑term
- IdentityDescriptor (peer_id, spki, seq, created_at, optional attestations, optional endorsements) surfaced to upper layers.
- Optional endorsement acceptance path via PolicyCallback.
Long‑term
- Witness/merkle transparency log (library + docker test harness) and trust‑layer policy wiring.
Test Plan for Transport Trust
We will land tests first, then implement code to satisfy them:
- TOFU: first contact accepts and pins; event emitted; subsequent contact matches pin.
- Rotation: continuity‑signed rotation accepted; unsigned rotation rejected (configurable policy).
- Channel binding: exporter signature exchange verifies; mismatch closes connection; event emitted.
- NAT/path: rebinding/path migration preserves identity; token binding uses (PeerId||CID||nonce).
- Policy gates: callbacks can allow/deny TOFU/rotation; defaults are safe.
Config and lint policy
- Global: forbid
unwrap
/expect
/panic!
in non‑tests; prefer thiserror
and tracing
.
- Clippy:
-D clippy::panic -D clippy::unwrap_used -D clippy::expect_used
(pedantic lints as warnings).
System Requirements
Minimum Requirements
- Operating System:
- Linux (kernel 3.10+)
- Windows 10/11 or Windows Server 2016+
- macOS 10.15+
- Android API 21+ / iOS 13+
- Memory: 64MB minimum, 256MB recommended per node
- CPU: Any x86_64 or ARM64 processor
- Network: UDP traffic on chosen port (default: random)
Platform-Specific Features
- Linux: Native netlink interface for network discovery
- Windows: Windows IP Helper API for interface enumeration
- macOS: System Configuration framework integration
Post-Quantum Cryptography (PQC)
ant-quic provides comprehensive support for post-quantum cryptography to protect against future quantum computer attacks. PQC is enabled by default and requires no feature flags or special configuration. Our implementation follows NIST standards and supports both hybrid (classical + PQC) and pure PQC modes.
Supported Algorithms (Always Available)
Key Exchange Mechanisms
Digital Signature Algorithms
Configuration (PQC Enabled by Default)
PQC is automatically enabled with no additional configuration required:
use ant_quic::{QuicP2PNode, PqcConfig, PqcMode, HybridPreference};
// Default configuration automatically uses hybrid PQC
let node = QuicP2PNode::new("0.0.0.0:0").await?;
// Explicit PQC configuration
let config = PqcConfig::default()
.mode(PqcMode::Hybrid) // Hybrid mode (default)
.hybrid_preference(HybridPreference::PreferPqc); // Prefer PQC (default)
let node = QuicP2PNode::with_pqc_config(config).await?;
// Pure PQC mode (quantum-resistant only)
let config = PqcConfig::default()
.mode(PqcMode::PqcOnly);
let node = QuicP2PNode::with_pqc_config(config).await?;
// Classical-only mode (for legacy compatibility)
let config = PqcConfig::default()
.mode(PqcMode::ClassicalOnly);
Operating Modes
Hybrid Mode (Recommended)
Combines classical ECDHE with ML-KEM for defense in depth:
- Uses X25519 + ML-KEM-768 for key exchange
- Maintains compatibility with non-PQC peers
- Protects against both classical and quantum attacks
- ~8.7% performance overhead
Pure Mode
Uses only post-quantum algorithms:
- ML-KEM-768 for key exchange
- ML-DSA-65 for signatures (when using certificates)
- Maximum quantum resistance
- Requires PQC support on both peers
Performance Impact
Based on our benchmarks:
- Connection Establishment: +8.7% overhead (hybrid mode)
- Memory Usage: +2.4MB per connection
- Throughput: Negligible impact (<1%)
- CPU Usage: +5-10% during handshake
Security Considerations
- Quantum Resistance: ML-KEM-768 provides 192-bit quantum security
- Hybrid Benefits: Protected even if one algorithm is broken
- Side Channels: Implementation includes countermeasures
- Key Sizes: Larger keys increase handshake data by ~3KB
Migration Guide
Upgrading existing applications to use PQC:
// Before (non-PQC)
let node = QuicP2PNode::new(addr).await?;
// After (with PQC)
let config = ant_quic::Config::default()
.with_pqc_mode(PqcMode::Hybrid)
.with_migration_period(30); // days
let node = QuicP2PNode::with_config(config).await?;
See examples/pqc_migration_demo.rs for a complete migration example.
Compliance
Our PQC implementation complies with:
-
NIST FIPS 203 (ML-KEM)
-
NIST FIPS 204 (ML-DSA)
-
SP 800-56C Rev. 2 (Key Derivation)
-
draft-ietf-tls-hybrid-design-10
-
draft-connolly-tls-mlkem-key-agreement-04
-
WASM: Experimental support via quinn-proto
Key Capabilities
- Symmetric NAT Penetration: Breakthrough restrictive NATs through coordinated hole punching
- QUIC-based Address Discovery: Automatic detection of peer addresses using OBSERVED_ADDRESS frames
- Multi-path Connectivity: Test multiple connection paths simultaneously for reliability
- Automatic Role Detection: Nodes dynamically become coordinators when publicly reachable
- Bootstrap Node Coordination: Decentralized discovery and coordination services
- Connection Migration: Seamless adaptation to changing network conditions
- Path Validation: Robust verification of connection paths before use
- Peer Authentication: Ed25519-based cryptographic authentication with challenge-response protocol
- Secure Chat Messaging: Encrypted peer-to-peer messaging with protocol versioning
- Real-time Monitoring: Built-in statistics dashboard for connection and performance metrics
- Address Change Detection: Automatic notification when peer addresses change
- Rate-Limited Observations: Configurable observation rates to prevent network flooding
Network Configuration
Port Requirements
Bootstrap Node Requirements
- Public IP: Static or dynamic with DNS
- Open UDP Port: Must be reachable from internet
- Bandwidth: Minimum 10 Mbps symmetric recommended
- CPU: 2+ cores recommended for high-traffic nodes
Quick Start
Installation
Pre-built Binaries
Download from GitHub Releases:
- Linux:
ant-quic-linux-x86_64
, ant-quic-linux-aarch64
- Windows:
ant-quic-windows-x86_64.exe
- macOS:
ant-quic-macos-x86_64
, ant-quic-macos-aarch64
# Linux/macOS
chmod +x ant-quic-linux-x86_64
./ant-quic-linux-x86_64 --help
From Source
# Install via cargo
cargo install ant-quic
# Or build from source
git clone https://github.com/autonomi/ant-quic
cd ant-quic
cargo build --release
# Docker installation (example Dockerfile available in repository)
docker run -p 9000:9000/udp autonomi/ant-quic:latest --listen 0.0.0.0:9000
Basic Usage
# Run as P2P node with QUIC protocol
ant-quic --listen 0.0.0.0:9000
# Connect to bootstrap nodes for peer discovery (automatic connection on startup)
ant-quic --bootstrap quic.saorsalabs.com:9000
# Discover your external address (requires bootstrap node)
ant-quic --bootstrap 159.89.81.21:9000
# Will print: 🌐 Discovered external address: YOUR.PUBLIC.IP:PORT
# Or if unable to discover: ⚠️ CANNOT_FIND_EXTERNAL_ADDRESS
# Run as coordinator with NAT traversal event monitoring
ant-quic --force-coordinator --listen 0.0.0.0:9000
# Run with dashboard for real-time statistics
ant-quic --dashboard --listen 0.0.0.0:9000
# Run multiple nodes locally for testing
ant-quic --listen 0.0.0.0:9000 # Bootstrap node
ant-quic --listen 0.0.0.0:9001 --bootstrap 127.0.0.1:9000 # Client node
# Check NAT traversal status while running
# Type /status to see discovered addresses and coordination sessions
# Type /help for available commands
Complete CLI Reference
ant-quic [OPTIONS] [SUBCOMMAND]
OPTIONS:
--listen <ADDR> Listen address (default: 0.0.0.0:0)
--bootstrap <ADDR1,ADDR2,...> Bootstrap nodes (comma-separated)
--coordinator Enable coordinator services
--force-coordinator Force coordinator mode (even behind NAT)
--minimal Minimal output for testing
--debug Enable debug logging
--dashboard Enable statistics dashboard
--dashboard-interval <SECS> Dashboard update interval (default: 2)
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
connect Connect to specific peer via coordinator
--coordinator <ADDR> Coordinator address
<PEER_ID> Target peer ID (hex)
coordinator Run as pure coordinator node
chat Run as chat client
--nickname <NAME> Chat nickname
help Print detailed help information
How It Works
ant-quic automatically detects its network reachability and adapts its role:
- Public IP + Reachable: Becomes full coordinator providing bootstrap services to other nodes
- Limited Reachability: Provides limited coordinator services while also acting as client
- Behind NAT: Client-only mode, connects to others through NAT traversal
This creates a decentralized bootstrap network where any publicly reachable node automatically helps coordinate connections for nodes behind NATs.
Library Usage
use ant_quic::{
nat_traversal_api::{NatTraversalEndpoint, NatTraversalConfig, EndpointRole},
CandidateSource, NatTraversalRole,
};
// Create NAT traversal endpoint (address discovery enabled by default)
let config = NatTraversalConfig {
role: EndpointRole::Client,
bootstrap_nodes: vec!["quic.saorsalabs.com:9000".parse().unwrap()],
max_candidates: 8,
coordination_timeout: Duration::from_secs(10),
discovery_timeout: Duration::from_secs(5),
};
let endpoint = NatTraversalEndpoint::new(config).await?;
// Connect to peer through NAT traversal
let peer_id = PeerId([0x12; 32]);
let connection = endpoint.connect_to_peer(peer_id).await?;
// Access discovered addresses
let discovered = endpoint.discovered_addresses();
println!("Discovered addresses: {:?}", discovered);
Configuration
Address Discovery Configuration
Address discovery is enabled by default and can be configured via:
use ant_quic::config::{EndpointConfig, AddressDiscoveryConfig};
let mut config = EndpointConfig::default();
// Configure address discovery
config.set_address_discovery_enabled(true); // Default: true
config.set_max_observation_rate(30); // Max 30 observations/second
config.set_observe_all_paths(false); // Only observe active path
// Or use environment variables
// ANT_QUIC_ADDRESS_DISCOVERY_ENABLED=false
// ANT_QUIC_MAX_OBSERVATION_RATE=60
Bootstrap nodes automatically use aggressive observation settings:
- Maximum observation rate (63 observations/second)
- Observe all paths regardless of configuration
- Immediate observation on new connections
Detailed Address Discovery Specifications
Transport Parameter (0x1f00):
- Bit Layout:
[enabled:1][observe_all_paths:1][max_rate:6]
- Max Rate Range: 0-63 observations per second
- Default Values: enabled=true, rate=10/sec, observe_all_paths=false
OBSERVED_ADDRESS Frame (0x43):
- Frame Format:
[type:varint][ip_version:1][address:4/16][port:2]
- IP Version: 4 (IPv4) or 6 (IPv6)
- Max Frame Size: 20 bytes
- Allowed In: 1-RTT packets only
Rate Limiting:
- Algorithm: Token bucket per path
- Burst Capacity: Equal to configured rate
- Token Precision: Floating-point for accuracy
- Bootstrap Multiplier: 6.3x (63/10) for bootstrap nodes
Examples
The repository includes several example applications demonstrating various features:
Run examples with:
cargo run --example simple_chat -- --listen 0.0.0.0:9000
cargo run --example chat_demo -- --bootstrap quic.saorsalabs.com:9000
cargo run --example dashboard_demo
Running Tests
# Run all tests including address discovery
cargo test --all
# Run specific test suites
cargo test address_discovery # Test QUIC address discovery
cargo test nat_traversal # Test NAT traversal
cargo test auth # Test authentication
# Run benchmarks
cargo bench observed_address # Benchmark address discovery performance
Local NAT Traversal Tests
You can run an end-to-end local NAT traversal harness (Docker-based) and also invoke it via cargo test
when needed.
# Fast local sanity (basic connectivity only)
./scripts/run-local-nat-tests.sh smoke
# Core NAT traversal matrix
./scripts/run-local-nat-tests.sh nat
# Full suite (includes optional categories)
./scripts/run-local-nat-tests.sh all
# Opt-in cargo tests that call the local harness (ignored by default)
RUN_LOCAL_NAT=1 cargo test --test nat_local -- --ignored local_nat_smoke
RUN_LOCAL_NAT=1 cargo test --test nat_local -- --ignored local_nat_core
Notes:
- The local harness writes results to
docker/results
and docker/logs
, and exits non-zero on failures.
- By default, some particularly strict combinations may be temporarily disabled if flaky, tracked in issues.
Real-World Testing Status
Completed Tests ✅
- Home Network NAT Traversal: Successfully connected through typical home router to cloud bootstrap node
- Connection time: < 200ms
- Stability: Excellent
- Success rate: 100%
Pending Tests 🚧
- Mobile Network (4G/5G): Requires physical device with hotspot capability
- Enterprise Network: Requires access to corporate network with strict firewall
- Carrier-Grade NAT (CGNAT): Requires specific ISP environment
- Long-running Stability: 1+ hour continuous connection test
Test results are being tracked in phase6_test_log.md
.
Architecture
ant-quic extends the proven Quinn QUIC implementation with sophisticated NAT traversal capabilities:
Core Components
- Transport Parameter Extensions: RFC-style negotiation of NAT traversal and address discovery
- NAT Traversal Parameter (0x58): Negotiates NAT traversal capabilities
- Address Discovery Parameter (0x1f00): Configures observation rates and behavior
- Extension Frames: Custom QUIC frames for address advertisement and coordination
ADD_ADDRESS
(0xBAAD): Advertise candidate addresses
PUNCH_ME_NOW
(0xBEEF): Coordinate simultaneous hole punching
REMOVE_ADDRESS
(0xDEAD): Remove invalid candidates
OBSERVED_ADDRESS
(0x43): Report observed peer addresses (IETF draft standard)
- ICE-like Candidate Pairing: Priority-based connection establishment
- Round-based Coordination: Synchronized hole punching protocol
- Address Discovery Engine: Automatic detection and notification of peer addresses
NAT Traversal Process
- Candidate Discovery: Enumerate local addresses and receive QUIC-observed addresses
- Bootstrap Coordination: Connect to bootstrap nodes for peer discovery
- Address Advertisement: Exchange candidate addresses with peers
- Priority Calculation: Rank candidate pairs using ICE-like algorithms
- Coordinated Hole Punching: Synchronized transmission to establish connectivity
- Path Validation: Verify connection paths before promoting to active
- Connection Migration: Adapt to network changes and path failures
Protocol Timeouts and Constants
- Connection Timeout: 30 seconds
- Coordination Timeout: 10 seconds
- Discovery Timeout: 5 seconds
- Retry Token Lifetime: 15 seconds
- Keep-Alive Interval: 5 seconds (bootstrap nodes)
- Max Idle Timeout: 60 seconds
- Dashboard Update: 2 seconds (configurable)
- Stats Collection: 30 second intervals
- Rate Limit Window: 60 seconds
Address Discovery Process
- Connection Establishment: Peers connect and negotiate address discovery support
- Address Observation: Endpoints observe the source address of incoming packets
- Frame Transmission: Send OBSERVED_ADDRESS frames to notify peers
- Rate Limiting: Token bucket algorithm prevents observation flooding
- Change Detection: Monitor for address changes and notify accordingly
- NAT Integration: Discovered addresses automatically become NAT traversal candidates
Network Topology Support
- Full Cone NAT: Direct connection establishment
- Restricted Cone NAT: Coordinated hole punching with address filtering
- Port Restricted NAT: Port-specific coordination protocols
- Symmetric NAT: Advanced prediction and multi-path establishment
- Carrier Grade NAT (CGNAT): Relay-assisted connection fallback
Specifications
ant-quic implements and extends the following IETF specifications and drafts:
1. QUIC Core Specification
2. Raw Key Encoding / Key Schedule Used by QUIC
3. QUIC Address Discovery Extension
4. Native NAT Traversal for QUIC
5. Post-Quantum Cryptography Standards
6. Post-Quantum TLS/QUIC Integration
7. Post-Quantum Certificate Support
Future Work & Roadmap
Current Implementation Status
✅ Completed:
- Core QUIC protocol with NAT traversal extensions
- Transport parameter negotiation (ID 0x58 for NAT, 0x1f00 for address discovery)
- Extension frames (ADD_ADDRESS, PUNCH_ME_NOW, REMOVE_ADDRESS, OBSERVED_ADDRESS)
- QUIC Address Discovery Extension (draft-ietf-quic-address-discovery-00)
- ICE-like candidate pairing with priority calculation
- Multi-path packet transmission
- Round-based coordination protocol
- High-level NAT traversal API with Quinn integration
- Candidate discovery framework with QUIC integration
- Connection establishment with fallback
- Comprehensive test suite (580+ tests including auth, chat, and security tests)
- Test binaries: coordinator, P2P node, network simulation
- Automatic bootstrap node connection on startup
- Peer authentication with Ed25519 signatures
- Secure chat protocol with version negotiation
- Real-time monitoring dashboard
- Address discovery enabled by default with configurable rates
- 27% improvement in connection success rates with address discovery
- 7x faster connection establishment times
- Performance benchmarks showing < 15ns overhead for address discovery
- Security validation tests completed
- Real-world NAT traversal validation (Phase 6) in progress
🚧 In Progress/TODO:
- Session state machine polling implementation
- Relay connection logic for fallback scenarios
- Mobile network NAT traversal testing (requires physical device testing)
- Enterprise firewall testing (requires corporate network environment)
Roadmap
v0.1.0 - Foundation Release ✅
- ✅ Core NAT traversal functionality
- ✅ Basic binary tools
- ✅ Full Quinn endpoint integration
- ✅ Complete platform-specific interface discovery
- 📋 Performance benchmarking and optimization
v0.2.0 - Authentication & Security ✅
- ✅ Peer authentication with Ed25519
- ✅ Secure chat protocol implementation
- ✅ Challenge-response authentication protocol
- ✅ Message versioning and protocol negotiation
v0.3.0 - Production Features ✅
- ✅ Real-time monitoring dashboard
- ✅ Automatic bootstrap node connection
- ✅ Comprehensive error handling
- ✅ GitHub Actions for automated releases
- ✅ Binary releases for multiple platforms
v0.4.0 - Bootstrap & Connectivity ✅
- ✅ Automatic bootstrap connection on startup
- ✅ Multi-bootstrap node support
- ✅ Connection state management
- ✅ Improved peer ID generation
- 🚧 Platform-specific optimizations
v0.4.3 - QUIC Address Discovery ✅
- ✅ IETF draft-ietf-quic-address-discovery-00 implementation
- ✅ OBSERVED_ADDRESS frame (0x43) support
- ✅ Transport parameter negotiation (0x1f00)
- ✅ Per-path rate limiting for observations
- ✅ Integration with NAT traversal for improved connectivity
- ✅ 27% improvement in connection success rates
- ✅ Address discovery enabled by default
v0.5.0 - Post-Quantum Cryptography (Released)
- ✅ ML-KEM-768 (Kyber) key encapsulation mechanism
- ✅ ML-DSA-65 (Dilithium) digital signatures
- ✅ Hybrid X25519+ML-KEM-768 key exchange
- ✅ Hybrid Ed25519+ML-DSA-65 signatures
- ✅ Backward compatibility with classical cryptography
- 📋 NIST FIPS 203/204 compliance
- 📋 Extended raw public key support for PQC algorithms
v0.6.0 - Advanced Features (Planned)
- 📋 Adaptive retry strategies based on network conditions
- 📋 Advanced relay selection algorithms
- 📋 Protocol optimizations from real-world usage data
- 📋 Enhanced debugging and diagnostic tools
- 📋 Performance profiling and bottleneck analysis
v1.0.0 - Autonomi Integration (Future)
- 📋 Native Autonomi network protocol integration
- 📋 Decentralized bootstrap node discovery
- 📋 Enhanced security features for P2P networks
- 📋 Integration with additional discovery mechanisms
- 📋 Production-ready defaults and configurations
Technical Debt & Improvements
High Priority (Blocking v0.1.0):
- Replace placeholder implementations with real peer ID management
- Implement comprehensive session lifecycle management
- Add adaptive timeout mechanisms based on network conditions
- Complete path validation with sophisticated algorithms
Medium Priority (v0.2.0):
- Enhance connection migration optimization strategies
- Add support for IPv6 dual-stack configurations
- Implement connection quality-based path selection
- Add comprehensive error recovery mechanisms
Low Priority (v0.3.0+):
- Optimize memory usage in high-throughput scenarios
- Add advanced congestion control for P2P networks
- Implement sophisticated relay overlay networks
- Add machine learning-based NAT prediction
Known Limitations
- Relay selection algorithms need real-world testing and optimization
- IPv6 support needs enhancement for production deployment
- Performance optimization required for high-scale deployments
Troubleshooting
Common Issues and Solutions
Connection Failures
# Issue: Cannot connect to bootstrap nodes
# Solution 1: Check firewall rules
sudo iptables -L -n | grep 9000 # Linux
netsh advfirewall firewall show rule name=all | findstr 9000 # Windows
# Solution 2: Verify bootstrap node is reachable
nc -u -v quic.saorsalabs.com 9000 # Test UDP connectivity
# Solution 3: Enable debug logging
ant-quic --debug --bootstrap quic.saorsalabs.com:9000
NAT Traversal Issues
- Symmetric NAT: Use multiple bootstrap nodes for better prediction
- CGNAT: May require relay assistance (fallback mechanism)
- Strict Firewall: Ensure UDP traffic is allowed bidirectionally
Address Discovery Problems
- No OBSERVED_ADDRESS frames: Check transport parameter negotiation
- Rate limiting: Increase
max_observation_rate
if needed
- Path changes: Enable
observe_all_paths
for multi-path scenarios
Debugging Commands
While running ant-quic, use these commands:
/status
- Show current connections and discovered addresses
/peers
- List connected peers
/stats
- Display connection statistics
/debug
- Toggle debug output
/help
- Show all available commands
Production Deployment
Bootstrap Node Setup
# Recommended systemd service file (/etc/systemd/system/ant-quic-bootstrap.service)
[Unit]
Description=ant-quic Bootstrap Node
After=network.target
[Service]
Type=simple
User=ant-quic
ExecStart=/usr/local/bin/ant-quic --force-coordinator --listen 0.0.0.0:9000 --dashboard
Restart=always
RestartSec=10
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
Scaling Considerations
Bootstrap Node Capacity
- Connections: ~10,000 concurrent with 4GB RAM
- Bandwidth: 1 Mbps per 100 active connections
- CPU: 1 core per 5,000 connections
- Storage: Minimal (< 1GB for logs)
High Availability Setup
# Run multiple bootstrap nodes behind DNS round-robin
quic.saorsalabs.com A 1.2.3.4
quic.saorsalabs.com A 5.6.7.8
quic.saorsalabs.com A 9.10.11.12
# Client configuration
ant-quic --bootstrap quic.saorsalabs.com:9000
Monitoring
Metrics Export
# Enable Prometheus metrics (when available)
ant-quic --metrics-port 9100
# Dashboard mode for real-time monitoring
ant-quic --dashboard --dashboard-interval 5
Key Metrics to Monitor
- Connection success rate
- Address discovery effectiveness
- NAT traversal success by type
- Bootstrap node load
- Bandwidth utilization
Performance
ant-quic is designed for high-performance P2P networking with minimal overhead:
Key Performance Metrics
- Low Latency: Minimized connection establishment time through parallel candidate testing
- High Throughput: Leverages Quinn's optimized QUIC implementation
- Scalability: Linear scaling up to 5000+ concurrent connections
- Reliability: Multiple connection paths and automatic failover
- Address Discovery Overhead: < 15ns per frame processing
- Connection Success: 27% improvement with QUIC address discovery enabled
- Establishment Speed: 7x faster connection times with discovered addresses
Benchmark Results
Frame Processing Performance
- OBSERVED_ADDRESS Encoding:
- IPv4: 15.397 ns (±0.181 ns)
- IPv6: 15.481 ns (±0.036 ns)
- OBSERVED_ADDRESS Decoding:
- IPv4: 6.199 ns (±0.015 ns)
- IPv6: 6.267 ns (±0.018 ns)
- Round-trip overhead: ~22ns total
Memory Usage
- Per-connection state: 560 bytes average
- Base state: 48 bytes
- Address tracking: 512 bytes (HashMap storage)
- Per-path overhead: 128 bytes
- 1000 connections: ~547 KB total memory
Scalability Testing
- 100 connections: Linear performance maintained
- 500 connections: No degradation observed
- 1000 connections: Consistent sub-microsecond operations
- 5000 connections: Linear scaling continues
Connection Establishment
- Without address discovery: Multiple attempts, 60% success after 3 tries
- With address discovery: Single attempt, immediate success
- Performance gain: 7x faster establishment, 27% higher success rate
Security
ant-quic implements comprehensive security measures for safe P2P communication:
Security Features
- Cryptographic Authentication: Ed25519-based peer authentication
- Address Spoofing Prevention: All OBSERVED_ADDRESS frames are cryptographically authenticated
- Rate Limiting: Token bucket algorithm prevents observation flooding
- Connection Isolation: Each connection maintains independent state
- Constant-Time Operations: Timing attack resistance in critical paths
Security Properties Validated
Address Spoofing Protection
- Only authenticated peers can send address observations
- Cryptographic binding between peer identity and observations
- Invalid observations automatically rejected
Rate Limiting Defense
- Configurable per-path rate limits (default: 10 observations/second)
- Bootstrap nodes use higher limits (63/second) for efficiency
- Token bucket ensures burst protection
Information Leak Prevention
- Address type detection uses constant-time operations
- Private address checking via bitwise operations
- No timing differences between IPv4/IPv6 processing
Attack Resistance
- Connection Hijacking: Protected via cryptographic isolation
- Memory Exhaustion: Limited to 100 addresses per connection
- Port Prediction: Strong randomization prevents guessing
- Amplification: Frame size (28 bytes) < typical request (100 bytes)
Security Testing
Run security tests with:
cargo test --test address_discovery_security
Benchmark Methodology
All benchmarks run on:
- Hardware: AMD Ryzen 9 5900X, 32GB RAM
- Network: 1 Gbps symmetric, <1ms local latency
- OS: Ubuntu 22.04 LTS, kernel 5.15
- Methodology:
- Criterion.rs for micro-benchmarks
- 1000 connection attempts for success rate
- 10,000 iterations for timing measurements
Documentation
API Stability and Versioning
Stable APIs (1.0 guarantee)
NatTraversalEndpoint
- High-level NAT traversal API
EndpointRole
- Node role configuration
- Transport parameters 0x58 (NAT) and 0x1f00 (Address Discovery)
- Extension frame types (0x40, 0x41, 0x42, 0x43)
Experimental APIs (subject to change)
- Low-level frame manipulation APIs
- Internal state machine interfaces
- Platform-specific discovery modules
Version Policy
- Major: Breaking changes to stable APIs
- Minor: New features, backwards compatible
- Patch: Bug fixes only
- Pre-1.0: Breaking changes in minor versions
Contributing
Contributions are welcome! Please see our contributing guidelines for details.
Development Setup
Prerequisites
- Rust: 1.85.0 or later (required for Rust Edition 2024)
- Features: This crate uses Rust Edition 2024 for improved async syntax and performance
- Platform: See System Requirements above
To verify your Rust version:
rustc --version # Should be 1.85.0 or newer
cargo --version
git clone https://github.com/autonomi/ant-quic
cd ant-quic
cargo test --all-features
# Run the QUIC binary
cargo run --bin ant-quic -- --help
Testing
# Run all tests
cargo test
# Run with verbose output
cargo test -- --nocapture
# Run specific test categories
cargo test nat_traversal
cargo test candidate_discovery
cargo test connection_establishment
# Run benchmarks
cargo bench
License
This project is licensed under either of
at your option.
Acknowledgments
Contributors
We are deeply grateful to all our contributors who have helped make this project possible. These true heroes dedicate their time and expertise to help others at their own cost. Thank you for your contributions to open source!
See our CONTRIBUTORS.md file for a full list of amazing people who have contributed to this project.
Security
For security vulnerabilities, please email security@autonomi.com rather than filing a public issue.