document binary pongs

binary-pongs
Zlatin Balevsky 2021-05-26 06:57:55 +01:00
parent 51f6a49459
commit 8f1b663bbd
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# Upgrade to binary pongs
### Motivation
The current intra-peer protocol is JSON, which means messages need to be ascii-armored. This is not as optimal as a binary protocol, especially when sending large blobs like I2P destinations.
### Upgrade path
The pinging node sends pings with the `version` field set to 2.
Upon receiving pings with version 2, the responding node will send a binary Pong.
### Pong format:
```
byte 0: message type, fixed at 1 for "Pong"
byte 1: version, fixed at 2
bytes 2-18: UUID of the Pong
byte 19: number of destinations contained in this Pong
bytes 20-end: destinations
```
### Other benefits
With the reduced size of Pong messages each Pong can carry more destinations. Also, the default maximum number of connections can be increased.