rift-nat
Part of the riftd project — serverless P2P voice + text chat over UDP.
What's in this crate?
rift-nat handles the hard problem of connecting peers behind NATs:
- STUN Client — Discover your public IP and port (server-reflexive address)
- TURN Client — Relay fallback when direct connection fails
- NAT Detection — Identify NAT type (full cone, restricted, symmetric)
- Hole Punching — Coordinated UDP hole punch attempts
- ICE-lite — Simplified ICE candidate gathering
Usage
use ;
// Discover reflexive address via STUN
let stun = new.await?;
let reflexive = stun.binding_request.await?;
println!;
// Probe NAT type
let nat_type = detect.await?;
TURN Setup
For self-hosted TURN relay, see TURN_GUIDE.md.
Related Crates
| Crate | Description |
|---|---|
| rift-rndzv | Rendezvous coordination |
| rift-mesh | Mesh networking (uses NAT traversal) |
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.