Update clog.md

This commit is contained in:
SoniEx2 2018-12-17 10:34:50 -02:00
parent 7c9df6ff95
commit 8ea54dd6f8
2 changed files with 11 additions and 9 deletions

18
clog.md
View File

@ -1,4 +1,4 @@
CAP prefix/clog
CAP soniex2.github.io/clog
===============
Copyright (c) 2018 Soni L. \<fakedme plus irkv3 at gmail dot com>
@ -12,13 +12,13 @@ Cap syntax
The capability shall be specified as
prefix/clog=hash_type,hash_type/tag,tag,tag
soniex2.github.io/clog=hash_type,hash_type/tag,tag,tag
Example:
prefix/clog=sha1,sha256/server-time,prefix/hash
soniex2.github.io/clog=sha1,sha256/time,soniex2.github.io/clog
`server-time` and `prefix/hash` are always implicitly specified, and should be omitted.
`time` and `soniex2.github.io/clog` are always implicitly specified, and should be omitted.
The `HASH` S2C command
----------------------
@ -48,22 +48,22 @@ Optionally, the server may include a server name with the HASH command:
<<< :server1.example.com HASH #channel :etc
<<< :server2.example.com HASH #channel :other
The `hash` message tag
The `clog` message tag
----------------------
The `hash` mesaage tag shall be sent with every `PRIVMSG`, `TOPIC` and `NOTICE`.
The `clog` message tag shall be sent with every `PRIVMSG`, `TOPIC` and `NOTICE`.
Syntax:
prefix/hash=type=counter/short_hash,type=counter/short_hash,...
soniex2.github.io/clog=type=counter/short_hash,type=counter/short_hash,...
The use of `short_hash` lowers bandwidth requirements. Consult your cryptography expert for best practices on using cryptography.
These hashes specify the previous "head(s)" of the clog. "Merges" are just messages with hashes from different sources.
The hash encompasses the message tags specified by the capability (e.g. `server-time` and `hash`), sorted according to UTF-8 byte order, and the contents of the IRC message, as seen in the following format:
The hash encompasses the message tags specified by the capability (e.g. `time` and `clog`), sorted according to UTF-8 byte order, and the contents of the IRC message, as seen in the following format:
@prefix/hash=...;server-time=... :nick!user@host PRIVMSG #channel :message
@soniex2.github.io/clog=...;time=... :nick!user@host PRIVMSG #channel :message
(This line is what gets hashed)

View File

@ -53,6 +53,7 @@ impl fmt::Display for Hash {
struct ServerData {
hashes: BTreeSet<Hash>,
message_queue: HashMap<String, VecDeque<(BTreeSet<Hash>, String)>>, // (source) server name -> messages
users: BTreeSet<String>,
}
impl ServerData {
@ -74,6 +75,7 @@ impl ServerData {
#[derive(Default)]
struct Game {
servers: BTreeMap<String, ServerData>,
users: BTreeSet<String>,
}
impl Game {