From e9aebac1a2a4732763c2f7e4428a23983d4eb6a3 Mon Sep 17 00:00:00 2001 From: bt Date: Fri, 10 Apr 2026 19:31:31 +0200 Subject: [common] Exchange messages between servers --- docs/rfc.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 14 deletions(-) (limited to 'docs/rfc.md') diff --git a/docs/rfc.md b/docs/rfc.md index 8c5818e..8296cfa 100644 --- a/docs/rfc.md +++ b/docs/rfc.md @@ -153,15 +153,16 @@ Payload type attributes describes following characteristics: * C - Client: can be send only by a client * E - Empty: signals an event but does not carry any data -| Type | Name | Attributes | -|------|-----------|------------| -| 0x00 | | R | -| 0x01 | Success | SCE | -| 0x02 | Error | S | -| 0x03 | Handshake | SC | -| 0x04 | Auth | C | -| 0x05 | Message | SC | -| 0xFF | Test | R | +| Type | Name | Attributes | +|------|------------|------------| +| 0x00 | | R | +| 0x01 | Success | SCE | +| 0x02 | Error | S | +| 0x03 | Handshake | SC | +| 0x04 | UserAuth | C | +| 0x05 | Message | SC | +| 0x06 | ServerAuth | S | +| 0xFF | Test | R | ### Success @@ -177,8 +178,9 @@ Payload is always empty for this type. | Type | Description | |------|-----------------------------------------------------------| -| 0x01 | Auth failed. Invalid username or password. | +| 0x01 | Client auth failed. Invalid username or password. | | 0x02 | Not found. User or channel cannot access user or channel. | +| 0x03 | Server auth failed. Unknown name. | ### Handshake @@ -200,13 +202,19 @@ different auth method will be used. | 0x01 | User -> Server | | 0x02 | Server -> Server | -### Auth +### UserAuth | Type | Name | |--------|----------| | string | username | | string | password | +### ServerAuth + +| Type | Name | +|--------|----------| +| string | name | + ### Message | Type | Name | @@ -238,7 +246,7 @@ Some operations require multiple rounds of communication. In this case payloads are send in a sequence. Payload that is not part of this specific operation (for example incoming message) cannot interrupt this process. -### Connection initialisation +### Client-Server connection initialisation ~~~ ascii-art +--------+ +--------+ @@ -254,7 +262,7 @@ specific operation (for example incoming message) cannot interrupt this process. | +- If [ver_major] does not match server | | protocol version close the connection | | - | Send [Auth] | + | Send [UserAuth] | +--------------------------->| | | | Send [Error 0x01] | @@ -263,4 +271,37 @@ specific operation (for example incoming message) cannot interrupt this process. | | | Send [Sucesss] | |<---------------------------+ -~~~ \ No newline at end of file +~~~ + +### Server-Server connection initialisation + +~~~ ascii-art ++--------+ +--------+ +| Server | | Server | ++----+---+ +----+---+ + | | + | Initialise TCP connection | + +--------------------------->| + | | + | Send [Handshake] | + +--------------------------->| + | | + | +- If [ver_major] does not match server + | | protocol version close the connection + | | + | Send [ServerAuth] | + +--------------------------->| + | | + | Send [Error 0x03] | + |<---------------------------+- If [name] is not present in known public + | | keys list. + | | + | Send [Sucesss] | + |<---------------------------+ +~~~ + +## Server to server operation + +Exchanging messages between SOLEC servers is a core concept behind the project. +Sending message to user residing on a different server require estabilishing a +connection between both servers. -- cgit v1.2.3