4 VoRS uses the Opus codec with 20ms frames with 48kHz 1ch 16-bit S-LE
5 sound. It uses native @code{libopus}'es Packet Loss Concealment (PLC)
6 feature when the number of lost frame does not exceed 32 count. DTX
7 (discontinuous transmission) is also on.
9 Each frame has a single byte stream identifier (unique identifier of the
10 participant) and 24-bit big-endian packet counter. Reordered packets are
11 dropped. 24-bit counter is long enough for very long talk sessions.
13 Each packet is encrypted with ChaCha20 and authenticated with SipHash24.
14 The keys are generated during the handshake procedure with the server
15 and is shared among the other participants. The stream identifier
16 together with the packet counter is used as a nonce.
18 It is tuned for 24Kbps bandwidth. But remember that it has additional 8B
19 of MAC tag, 4B VoRS, 8B UDP and 40B IPv6 headers.
21 Each client handshakes with the server over TCP connection using the
22 @url{http://noiseprotocol.org/, Noise}-NK protocol pattern with
23 curve25519, ChaCha20-Poly1305 and BLAKE2s algorithms.
27 @item Client sends @code{VoRS v1} to the socket. Just a magic number.
29 @item All next messages are prepended with 16-bit big-endian length.
31 @item Client sends initial Noise handshake message with his username as
34 @item Server answers with final noise handshake message with the payload
35 of @code{OK HEX(COOKIE)}, or any other failure message. It may reject a
36 client if there are too many peers or its name is already taken.
38 @item The 128-bit cookie is sent by client over UDP to the server every
39 second. If UDP packets are lost, then no connection is possible and
40 after a timeout the server drops the TCP connection.
42 @item Otherwise it replies with @code{SID XXX}, where XXX is ASCII
43 decimal stream number client must use.
45 @item @code{PING} and @code{PONG} messages are then sent every ten
46 seconds as a heartbeat.
51 S <- C : e, es, "username"
52 S -> C : e, ee, "OK COOKIE"
60 S -> C : "ADD SID USERNAME HEX(KEY)"
67 Every second the client sends UDP packet with his single-byte stream
68 identifier, even if it's muted. That may help punching holes in stateful
71 Clients are notified about new peers appearance with @code{ADD}
72 commands, telling their SIDs, usernames and keys. @code{DEL} notifies