From 8383370a89ef85da7cba32831c87c8fa372da0d4 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Fri, 4 Nov 2022 17:46:45 -0700 Subject: [PATCH] Add ping spec --- ping/ping.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ ping/ping.svg | 22 ++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 ping/ping.md create mode 100644 ping/ping.svg diff --git a/ping/ping.md b/ping/ping.md new file mode 100644 index 0000000..196058f --- /dev/null +++ b/ping/ping.md @@ -0,0 +1,56 @@ +# Ping + +| Lifecycle Stage | Maturity | Status | Latest Revision | +| --------------- | ------------------------ | ------ | --------------- | +| 1A | Candidate Recommendation | Active | r0, 2022-11-04 | + +Authors: [@marcopolo] + +Interest Group: [@marcopolo], [@mxinden], [@marten-seemann] + +[@marcopolo]: https://github.com/mxinden +[@mxinden]: https://github.com/mxinden +[@marten-seemann]: https://github.com/marten-seemann + +# Table of Contents +- [Protocol](#protocol) +- [Diagram](#diagram) + +# Protocol + +The ping protocol is a simple request response protocol. The client sends a +payload of 32 random bytes, and the server responds with the same 32 bytes. The +client then measures the RTT from the time it wrote the bytes to the time it +received the bytes. The client may repeat the process by sending another payload +with random bytes, so the server _should_ loop and echo the next payload. The +client may close the write side of the stream after sending a payload, the +server _should_ finish writing the echoed payload and then exit the loop and +close the stream. + +The protocol id is `/ipfs/ping/1.0.0`. + +# Diagram + +![Ping Protocol Diagram](./ping.svg) + +
+ Instructions to reproduce diagram + +From the root, run: `plantuml -tsvg ping/ping.md` + +``` +@startuml +skinparam backgroundColor white + +entity Client +entity Server + +== /ipfs/ping/1.0.0 == +loop until Client closes write + Client -> Server: 32 random bytes + Client <- Server: Same 32 random bytes +end +@enduml +``` + +
\ No newline at end of file diff --git a/ping/ping.svg b/ping/ping.svg new file mode 100644 index 0000000..51edd42 --- /dev/null +++ b/ping/ping.svg @@ -0,0 +1,22 @@ +ClientClientServerServer/ipfs/ping/1.0.0loop[until Client closes write]32 random bytesSame 32 random bytes \ No newline at end of file