]> Sergey Matveev's repositories - vors.git/commitdiff
Detailed commands description
authorSergey Matveev <stargrave@stargrave.org>
Thu, 29 May 2025 15:25:39 +0000 (18:25 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 29 May 2025 15:27:50 +0000 (18:27 +0300)
doc/Protocol

index ec6d154deb1fe323bf6c50e2ae72fc74a2dc3994c1378d466fc7af528c30366c..34ed3d699ff94f296f863f98a8b48c984ee21a0e49dfbb417baa6b4666ed382e 100644 (file)
@@ -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))