@@ -338,12 +338,13 @@ repeating the lookup procedure on another, closer node.
338
338
339
339
### Message flow
340
340
341
- The protocol introduces the notification packet kind. There are 4 total message
342
- containers, these are abbreviated in the sequence diagram below as follows:
341
+ There are 4 total message containers, these are abbreviated in the sequence diagram below
342
+ as follows:
343
+
343
344
- m - [ message packet]
344
345
- whoareyou - [ WHOAREYOU packet]
345
346
- hm - [ handshake message packet]
346
- - n - [ notification packet]
347
+ - s - [ session message packet]
347
348
348
349
``` mermaid
349
350
sequenceDiagram
@@ -355,32 +356,32 @@ containers, these are abbreviated in the sequence diagram below as follows:
355
356
Alice->>Bob: m(nonce,FINDNODE)
356
357
Note left of Alice:Hole punched in Alice's NAT for Bob
357
358
Note left of Alice:FINDNODE timed out
358
- Alice->>Relay: n (RELAYINIT[nonce])
359
- Relay->>Bob:n (RELAYMSG[nonce])
359
+ Alice->>Relay: s (RELAYINIT[nonce])
360
+ Relay->>Bob: s (RELAYMSG[nonce])
360
361
Bob-->>Alice: whoareyou(nonce)
361
362
Note right of Bob: Hole punched in Bob's NAT for Alice
362
363
Alice-->>Bob: hm(FINDNODE)
363
364
```
364
- Bob is behind a NAT. Bob is in Relay's kbuckets, they have a session together and Bob
365
- has sent a packet to Relay in the last ~ 20 seconds hence Relay can get through Bob's
366
- NAT[ ^ 1 ] .
367
-
368
- As part of recursive query for peers, Alice sends a [ FINDNODE] request to Bob, who's
369
- ENR it received from Relay. By making an outgoing request to Bob, if Alice is behind a
370
- NAT, Alice's NAT adds the filtering rule
371
- ` (Alice's-LAN-ip, Alice's-LAN-port, Bob's-WAN-ip, Bob's-WAN- port, entry-lifetime)` to
372
- it's UDP session table [ ^ 2 ] [ ^ 3 ] . This means a hole now is punched for Bob in Alice's NAT
373
- for the duration of ` entry-lifetime ` . The request to Bob times out as Bob is behind a NAT.
374
-
375
- Alice initiates an attempt to punch a hole in Bob's NAT via Relay. Alice resets the request
376
- time out on the timed out [ FINDNODE] message and wraps the message's nonce in a [ RELAYINIT ]
377
- notification and sends it to Relay. The notification also contains its ENR and Bob's node
378
- id.
379
-
380
- Relay disassembles the [ RELAYINIT] notification and uses the ` tgt-id ` to look up Bob's
381
- ENR in its kbuckets. With high probability, Relay will find Bob's ENR in its kbuckets
382
- as ~ 1 second ago, Relay assembled a [ NODES] response for Alice containing Bob's ENR (see
383
- [ UDP Communication] for recommended time out duration). Relay assembles a [ RELAYMSG]
365
+
366
+ Bob is behind a NAT. Bob is in Relay's kbuckets, they have a session together and Bob has
367
+ sent a packet to Relay in the last ~ 20 seconds hence Relay can get through Bob's NAT[ ^ 1 ] .
368
+
369
+ As part of recursive query for peers, Alice sends a [ FINDNODE] request to Bob, who's ENR
370
+ it received from Relay. By making an outgoing request to Bob, if Alice is behind a NAT,
371
+ Alice's NAT adds the filtering rule `(Alice's-LAN-ip, Alice's-LAN-port, Bob's-WAN-ip,
372
+ Bob's-WAN-port, entry-lifetime)` to it's UDP session table [ ^ 2 ] [ ^ 3 ] . This means a hole now
373
+ is punched for Bob in Alice's NAT for the duration of ` entry-lifetime ` . The request to Bob
374
+ times out as Bob is behind a NAT.
375
+
376
+ Alice initiates an attempt to punch a hole in Bob's NAT via Relay. Alice resets the
377
+ request time out on the timed out [ FINDNODE] message and wraps the message's nonce in a
378
+ [ RELAYINIT ] notification and sends it to Relay. The notification also contains its ENR and
379
+ Bob's node id.
380
+
381
+ Relay disassembles the [ RELAYINIT] notification and uses the ` tgt-id ` to look up Bob's ENR
382
+ in its kbuckets. With high probability, Relay will find Bob's ENR in its kbuckets as ~ 1
383
+ second ago, Relay assembled a [ NODES] response for Alice containing Bob's ENR (see [ UDP
384
+ Communication] for recommended time out duration). Relay assembles a [ RELAYMSG]
384
385
notification with Alice's message nonce and ENR, then sends it to the address in Bob's
385
386
ENR.
386
387
@@ -401,15 +402,15 @@ back up relays for peers small.
401
402
402
403
Apart from the state that is saved by not storing more than the last peer to send us an
403
404
ENR as its potential relay, the longer time that has passed since a peer sent us an ENR,
404
- the less guarantee we have that the peer is in fact connected to the owner of that ENR
405
- and hence of its ability to relay.
405
+ the less guarantee we have that the peer is in fact connected to the owner of that ENR and
406
+ hence of its ability to relay.
406
407
407
408
[ EIP-778 ] : ../enr.md
408
409
[ identity scheme ] : ../enr.md#record-structure
409
410
[ message packet ] : ./discv5-wire.md#ordinary-message-packet-flag--0
411
+ [ session message packet ] : ./discv5-wire.md#session-message-packet-flag--3
410
412
[ handshake message packet ] : ./discv5-wire.md#handshake-message-packet-flag--2
411
413
[ WHOAREYOU packet ] : ./discv5-wire.md#whoareyou-packet-flag--1
412
- [ notification packet ] : ./discv5-wire.md#notification-packet-flag--3
413
414
[ PING ] : ./discv5-wire.md#ping-request-0x01
414
415
[ PONG ] : ./discv5-wire.md#pong-response-0x02
415
416
[ FINDNODE ] : ./discv5-wire.md#findnode-request-0x03
0 commit comments