add NAT-PMP for automatic port mapping and external address discovery

This commit is contained in:
2026-02-09 17:05:24 -03:00
parent 7b47ef155c
commit cf5eb0d5fd
11 changed files with 970 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -e
echo "=== NAT-PMP Peer Test ==="
echo "Peer: $PEER_NAME"
echo "Port: $PEER_PORT"
echo "Gateway: $GATEWAY_IP"
# Set default route through the NAT router
echo "Setting default route through NAT router..."
ip route del default 2>/dev/null || true
ip route add default via $GATEWAY_IP
echo "Current routes:"
ip route
echo ""
echo "Testing NAT-PMP discovery..."
# Run MWP demo (it will try NAT-PMP automatically)
exec mwp-demo \
--name "$PEER_NAME" \
--port "$PEER_PORT" \
--deterministic \
"$@"