From: Sergey Matveev Date: Thu, 29 May 2025 15:25:39 +0000 (+0300) Subject: Detailed commands description X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c486180342ec6385cb0a383549c1eb127638b9d60fafbc32ab1232cf3b764d03;p=vors.git Detailed commands description --- diff --git a/doc/Protocol b/doc/Protocol index ec6d154..34ed3d6 100644 --- a/doc/Protocol +++ b/doc/Protocol @@ -35,12 +35,12 @@ algorithms. * Client sends initial Noise handshake message with his username, room name and optional BLAKE2s-256 hash of the room's password (or an empty - string) as a payload: ["USERNAME", "ROOM", BLAKE2s(PASSWORD)]. + string) as a payload: [USERNAME, ROOM, hash(PASSWD)]. -* Server answers with final noise handshake message with the ["COOKIE", - COOKIE], or ["ERR", MSG] failure message. It may reject a client if - there are too many peers, its name is already taken or it provided an - invalid room's password. +* Server answers with final noise handshake message with the + ["COOKIE", COOKIE], or ["ERR", MSG] failure message. It may reject a + client if there are too many peers, its name is already taken or it + provided an invalid room's password. * The 128-bit cookie is sent by client over UDP to the server every second. If UDP packets are lost, then no connection is possible and @@ -52,25 +52,19 @@ algorithms. * client's UDP address knowledge (after passing NAT, its port may differ from known to client one) -* Server replies with ["SID", X], where X is single byte stream number - client must use. +* Server replies with ["SID", SID], where SID is single byte stream + number client must use. * ["PING"] and ["PONG"] messages are then sent every ten seconds as a heartbeat. -S <- C : e, es, NS(NS("USERNAME") || NS("ROOM") || NS("PASSWORD")) -S -> C : e, ee, NS(NS("COOKIE") || NS(COOKIE)) -S <- C : UDP(COOKIE) -S -> C : NS(NS("SID") || NS(X)) + S <- C : e, es, NS(NS(USERNAME) || NS(ROOM) || NS(hash(PASSWD))) + S -> C : e, ee, NS(NS("COOKIE") || NS(COOKIE)) + S <- C : UDP(COOKIE) + S -> C : NS(NS("SID") || NS(SID)) -S <- C : NS(NS("PING")) -S -> C : NS(NS("PONG")) -S <> C : ... - -S -> C : NS(NS("ADD") || NS(SID) || NS(USERNAME) || NS(KEY)) -S -> C : ... - -S -> C : NS(NS("DEL") || NS(SID)) -S -> C : ... + S <- C : NS(NS("PING")) + S -> C : NS(NS("PONG")) + S <> C : ... Every second the client sends UDP packet with his single-byte stream identifier, even if it's muted. That may help punching holes in stateful @@ -78,5 +72,20 @@ firewalls. Clients are notified about new peers appearance with "ADD" commands, telling their SIDs, usernames and keys. "DEL" notifies about leaving -peers. "MUTED", "UNMUTED" notifies peer's mute toggling. "CHAT" -broadcasts the message in the room. +peers. + + S -> C : NS(NS("ADD") || NS(SID) || NS(USERNAME) || NS(KEY)) + S -> C : ... + + S -> C : NS(NS("DEL") || NS(SID)) + S -> C : ... + +"MUTED", "UNMUTED" notifies peer's mute toggling: + + S <- C : NS(NS("[UN]MUTED")) + S -> C*: NS(NS("[UN]MUTED"), NS(SID)) + +"CHAT" broadcasts the message in the room: + + S <- C : NS(NS("CHAT"), NS(MSG)) + S -> C*: NS(NS("CHAT"), NS(SID), NS(MSG))