Skip to content

Commit 736c6e3

Browse files
committed
discv5: add diagram svg and wrap code in processing instruction
Seems like a processing instruction is the best way to contain the source text. An HTML comment can't be used because it clashes with the mermaid syntax.
1 parent 614654d commit 736c6e3

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

discv5/discv5-theory.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -369,22 +369,24 @@ each message in the diagram below. We use these abbreviations:
369369
- `H(X)`: [handshake message packet] containing request `X`
370370
- `s(M)`: [session message packet] containing message `M`
371371

372-
```mermaid
373-
sequenceDiagram
374-
participant Alice
375-
participant Relay
376-
participant Bob
377-
378-
Relay-->>Alice: s(NODES[Bob's ENR])
379-
Alice->>Bob: m(nonce,FINDNODE)
380-
Note left of Alice:Hole punched in Alice's NAT for Bob
381-
Note left of Alice:FINDNODE timed out
382-
Alice->>Relay: s(RELAYINIT[nonce])
383-
Relay->>Bob: s(RELAYMSG[nonce])
384-
Bob-->>Alice: whoareyou(nonce)
385-
Note right of Bob: Hole punched in Bob's NAT for Alice
386-
Alice-->>Bob: H(FINDNODE)
387-
```
372+
<?mermaid
373+
sequenceDiagram
374+
participant Alice
375+
participant Relay
376+
participant Bob
377+
378+
Relay-->>Alice: s(NODES[Bob's ENR])
379+
Alice->>Bob: m(nonce,FINDNODE)
380+
Note left of Alice:Hole punched in Alice's NAT for Bob
381+
Note left of Alice:FINDNODE timed out
382+
Alice->>Relay: s(RELAYINIT[nonce])
383+
Relay->>Bob: s(RELAYMSG[nonce])
384+
Bob-->>Alice: whoareyou(nonce)
385+
Note right of Bob: Hole punched in Bob's NAT for Alice
386+
Alice-->>Bob: H(FINDNODE)
387+
?>
388+
389+
![Diagram](./img/nat-hole-punching-flow.svg)
388390

389391
Preconditions: Bob is behind NAT. Bob is contained in Relay's node table, they have an
390392
established session and Bob has sent a packet to Relay in the last ~20 seconds hence Relay

0 commit comments

Comments
 (0)