add UPnP IGD for automatic port mapping and external address discovery

This commit is contained in:
2026-02-09 17:49:44 -03:00
parent cf5eb0d5fd
commit 33730fed8a
13 changed files with 1364 additions and 7 deletions

View File

@@ -78,17 +78,19 @@ zig-p2p is a high-performance, zero-dependency P2P networking library written in
- Large file (>100GB) testing limited
- No built-in compression (application layer concern)
### NAT Traversal (7/10)
### NAT Traversal (8/10)
**Implemented:**
- STUN client for public IP discovery
- NAT-PMP (RFC 6886) - automatic port mapping via 2-packet UDP exchange
- UPnP IGD - SSDP discovery + SOAP port mapping for consumer routers
- IP Reflection - bundled STUN via DHT responses (zero-infrastructure)
- UDP hole punching
- Connection reversal for symmetric NATs
**Limitations:**
- TURN relay not fully implemented
- Some carrier-grade NAT scenarios may fail
- Requires fallback strategy for ~10% of network configurations
- Requires fallback strategy for ~5% of network configurations
### DHT & Discovery (8/10)
@@ -154,9 +156,8 @@ zig-p2p is a high-performance, zero-dependency P2P networking library written in
## Known Limitations
1. **No TCP fallback** - UDP only, some corporate firewalls may block
2. **No UPnP** - Manual port forwarding may be needed
3. **Single-threaded event loop** - By design, but limits single-connection throughput
4. **No streaming API** - Piece-based transfer only
2. **Single-threaded event loop** - By design, but limits single-connection throughput
3. **No streaming API** - Piece-based transfer only
---