Add initial (unfinished) protocol docs
This commit is contained in:
parent
97da517a0e
commit
b1485d5410
1 changed files with 52 additions and 0 deletions
52
docs/protocol.md
Normal file
52
docs/protocol.md
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
# systemquery protocol
|
||||||
|
This document details the protocol implemented by systemquery. The protocol has multiple layers to it - these are documented each in their own sections:
|
||||||
|
|
||||||
|
1. Framed transport
|
||||||
|
2. Encryption
|
||||||
|
3. JSON messages
|
||||||
|
- Also handles key exchange
|
||||||
|
|
||||||
|
The protocol aims to have the following properties:
|
||||||
|
|
||||||
|
- It's peer-to-peer
|
||||||
|
- It's decentralised (i.e. there's no leading peer)
|
||||||
|
- This may change in the future if there's a need for a leading peer
|
||||||
|
- It follows existing established standards where possible
|
||||||
|
- All communication is encrypted
|
||||||
|
- In order to join, peers must know the same join secret (aka a pre-shared key)
|
||||||
|
- In the future, full mesh network routing
|
||||||
|
|
||||||
|
The following properties are out-of-scope:
|
||||||
|
|
||||||
|
- Tolerate malicious nodes
|
||||||
|
|
||||||
|
|
||||||
|
## Framed Transport
|
||||||
|
|
||||||
|
|
||||||
|
## JSON messages
|
||||||
|
JSON messages look like this:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"event": "EVENT_NAME",
|
||||||
|
"message": { "message_object": "here" }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The following event names and their associated message objects are listed below:
|
||||||
|
|
||||||
|
### Event `query`
|
||||||
|
The sender requests a table from the receiver.
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
|
||||||
|
- **string `name`:** The name of the table being requested.
|
||||||
|
|
||||||
|
### Event `query-response`
|
||||||
|
The send response to the receiver's earlier `query` message.
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
|
||||||
|
- **string `name`:** The name of the table.
|
||||||
|
- **object `table`:** The requested table.
|
Loading…
Reference in a new issue