@@ -405,7 +405,7 @@ ENR as its potential relay, the longer time that has passed since a peer sent us
405
405
the less guarantee we have that the peer is in fact connected to the owner of that ENR and
406
406
hence of its ability to relay.
407
407
408
- ### Job of keeping the hole punched falls on Bob and Bob's incentives to do so
408
+ ### Job of keeping the hole punched falls on Bob and Bob's incentive to do so
409
409
410
410
UDP session table entry lifetimes are configurable, though a common lower bound is 20
411
411
seconds[^1]. Bob must periodically reset the session table entry for Alice in its NAT to
@@ -421,6 +421,16 @@ session. If there is no hole for Alice in Bob's NAT when Alice carries out a
421
421
behind a NAT intends to frequently communicate with a peer, reestablishing the session is
422
422
more costly than managing the interval of sent packets to that peer.
423
423
424
+ ### Discovering if the local node is behind a NAT and must keep holes for peers punched
425
+
426
+ A node may be assigned an externally reachable socket to advertise at start-up. If it is
427
+ not, the [external socket used by the local node is discovered] at runtime and at start-up
428
+ the node assumes it is behind a NAT and must activate the [mechanism for keeping holes punched].
429
+ Once an externally reachable IP address is known, implementations will try to bind to the
430
+ address at some number of ports, randomly selected from a given range of probably unused
431
+ ports. If binding succeeds for any port, the node is not behind a NAT and the
432
+ [mechanism for keeping holes punched] is deactivated.
433
+
424
434
[EIP-778]: ../enr.md
425
435
[identity scheme]: ../enr.md#record-structure
426
436
[message packet]: ./discv5-wire.md#ordinary-message-packet-flag--0
@@ -437,6 +447,8 @@ more costly than managing the interval of sent packets to that peer.
437
447
[UDP communication]: ./discv5-wire.md#udp-communication
438
448
[Sessions]: ./discv5-theory.md#sessions
439
449
[liveness check]: ./discv5-theory.md#table-maintenance-in-practice
450
+ [external socket used by the local node is discovered]: ./discv5-theory.md#maintaining-the-local-node-record
451
+ [mechanism for keeping holes punched]: ./discv5-theory.md#job-of-keeping-the-hole-punched-falls-on-bob-and-bob's-incentive-to-do-so
440
452
441
453
[^1]: https://pdos.csail.mit.edu/papers/p2pnat.pdf
442
454
[^2]: https://datatracker.ietf.org/doc/html/rfc4787
0 commit comments