dave on Nostr: Went down the NAT hole punching rabbit hole far enough to write a basic STUN client ...
Went down the NAT hole punching rabbit hole far enough to write a basic STUN client before running into why most hole punching literature is about UDP and not TCP: both peers must simultaneously open connections to each other in order for (most) NATs to behave properly. STUN will let you know your socket's public address and port, but it won't help you rendezvous with another peer. Learned a lot, but somewhat of a dead end. This page has probably the best and most understandable explanations of various hole punching scenarios:
https://bford.info/pub/net/p2pnat/Published at
2023-06-28 19:05:50Event JSON
{
"id": "632c988080178bee147a07075c15961d7b13c88f5b1964b9338f3a1f70eb11ff",
"pubkey": "1ba3c31c0ac2a0161b903be74e8a93bac9e51f68b21aa5cc5e3b6f9150e993e3",
"created_at": 1687979150,
"kind": 1,
"tags": [
[
"mostr",
"https://toot.cat/users/dthompson/statuses/110623401620386980"
]
],
"content": "Went down the NAT hole punching rabbit hole far enough to write a basic STUN client before running into why most hole punching literature is about UDP and not TCP: both peers must simultaneously open connections to each other in order for (most) NATs to behave properly. STUN will let you know your socket's public address and port, but it won't help you rendezvous with another peer. Learned a lot, but somewhat of a dead end. This page has probably the best and most understandable explanations of various hole punching scenarios: https://bford.info/pub/net/p2pnat/",
"sig": "9d18514196ca55d8dcd3ace690fa453f59503c41d7230aa99e9560f8275055878a2006954ac8adaf9362f8b019bd0fc20469c3fffb50e2135f6f9e5c4102f474"
}