@@ -525,6 +525,35 @@ advertisement, but samples the average number of results from TOPICQUERY instead
525
525
average time to registration. The radius estimation value can be shared with the
526
526
registration algorithm if the same topic is being registered and searched for.
527
527
528
+ ## Hole punch asymmetric NATs
529
+
530
+ The protocol introduces the notification packet kind. There are 4 total message
531
+ containers, these are abbreviated in the sequence diagram below as follows:
532
+ - m - message packet
533
+ - whoareyou - WHOEAREYOU packet
534
+ - hm - handshake message packet
535
+ - n - notification packet
536
+
537
+ ``` mermaid
538
+ sequenceDiagram
539
+ Relay-->>Alice: m(NODES[Bob's ENR])
540
+ Alice->>Bob: m(nonce,FINDNODE)
541
+ Note left of Alice:Hole punched in Alice's NAT for Bob
542
+ Alice->>Relay: n(RELAYINIT[nonce])
543
+ Relay->>Bob:n(RELAYMSG[nonce])
544
+ Bob-->>Alice: whoareyou(nonce)
545
+ Note right of Bob: Hole punched in Bob's NAT for Alice
546
+ ```
547
+ Bob is behind a NAT. Bob is in Relay's kbuckets, they have a session together.
548
+
549
+ As part of a periodic recursive query to fill its kbuckets, Alice sends a FINDNODE
550
+ request to Bob, who's ENR it received from Relay. By making an outgoing request to
551
+ Bob, if Alice is behind a NAT, Alice's NAT adds the filtering rule
552
+ ` (Alice's-LAN-ip, Alice's-LAN-port, Bob's-WAN-ip, Bob's-WAN-port) ` [ ^ 1 ] to it's UDP table.
553
+ The request to Bob times out as Bob is behind a NAT.
554
+
555
+
556
+
528
557
[ EIP-778 ] : ../enr.md
529
558
[ identity scheme ] : ../enr.md#record-structure
530
559
[ handshake message packet ] : ./discv5-wire.md#handshake-message-packet-flag--2
@@ -535,3 +564,4 @@ registration algorithm if the same topic is being registered and searched for.
535
564
[ REGTOPIC ] : ./discv5-wire.md#regtopic-request-0x07
536
565
[ REGCONFIRMATION ] : ./discv5-wire.md#regconfirmation-response-0x09
537
566
[ TOPICQUERY ] : ./discv5-wire.md#topicquery-request-0x0a
567
+ [ ^ 1 ] : https://datatracker.ietf.org/doc/html/rfc4787
0 commit comments