https://github.com/schmichael/gophernet
https://github.com/schmichael/gophernet
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/schmichael/gophernet
- Owner: schmichael
- Created: 2014-02-10T00:41:04.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-10T00:42:02.000Z (over 12 years ago)
- Last Synced: 2025-01-26T00:12:54.089Z (over 1 year ago)
- Language: Go
- Size: 102 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Gophernet
=========
A mesh network inspired by whispering gophers.
Wire Protocol
-------------
*Header*
```
+-------+---------+------+-----------+----------+----------+------------+
| Magic | Version | Hops | ECDSA | Sender | Encoding | Payload |
| Byte | Field | Left | Signature | UUID | Field | Size (int) |
+-------+---------+------+-----------+----------+----------+------------+
| byte | int8 | int8 | 64 bytes | 16 bytes | int8 | int32 |
+-------+---------+------+-----------+----------+----------+------------+
| | | drop | 32B for r | UUID4 | 0 = JSON | |
| 'g' | 1 | when | | linked to| 1=Snappy | Big endian |
| | | zero | 32B for s | pubkey | + JSON | |
+-------+---------+------+-----------+----------+----------+------------+
```
*Versions*
Version 1 of gophernet uses ECDSA-with-SHA1 message signing/verification. The
hash is over the concatenation of the Sender UUID, Encoding byte, Payload Size,
and payload.
Negative versions (high bit set) are reserved for private test networks and
should be ignored.
Version 0 is reserved for heartbeat packets.
*Heartbeat packet*
Just the magic byte followed by all 0 bytes for the rest of the header.
**Payload**
Version 1 uses an extensible JSON payload designed to be extensible
without breaking backward compatibility.
*Standard fields*
* ``type``: Speficies message type (e.g.: pubkey, chat)
* ``ts``: Timestamp message was sent at in RFC3339 format
* ``id``: Unique
*Key announcment*
```json
{
"type": "pubkey",
"from": "36 hex character UUID (with dashes)",
"nick": "nickname to associate with pubkey and uuid",
"ecdsa.P256": {
"x": "hex encoded X component",
"y": "hex encoded Y component",
}
}
```
*Chat message*
```json
{
"nick": "",
"msg": ""
}
```