Commit fbc5f3c6 authored by Éloïs's avatar Éloïs

[ref] ws2pv2: FLAGS Msg : rename and change fields order

parent f214465c
......@@ -40,7 +40,7 @@ We are also taking advantage of these changes to address minor issues :
* [List of accepted v1 messages](#list-of-accepted-v1-messages)
* [CONNECT Message](#connect-message)
* [ACK Message](#ack-message)
* [FLAGS Message](#flags-message)
* [SECRET FLAGS Message](#secret-flags-message)
* [OK Message](#ok-message)
* [Rules for accepting an incoming connection](#rules-for-accepting-an-incoming-connection)
* [WS2Pv2 Messages](#ws2pv2-messages)
......@@ -438,16 +438,20 @@ In case of equality, the order in which the endpoints will be contacted will dep
After sorting all WS2P endpoints according to the criteria described in the previous section,
Duniter tries to connect to the other nodes.
for each connection attempt, the process is as follows:
for each connection attempt, the process is as follows for initiator :
1. Opening a websocket pointing to the remote endpoint. If the websocket has been successfully opened before the timeout*, send a CONNECT message. Otherwise, log the error and close the websocket.
2. Wait to receive a CONNECT message from the remote node, checking the validity. If the CONNECT message is valid, then sending an ACK message. Otherwise, log the error and close the websocket.
3. Wait to receive an ACK message from the remote node, checking the validity. If the ACK message is valid, then sending a FLAGS message. Otherwise, log the error and close the websocket.
4. Wait to receive a FLAGS message from the remote node, checking the validity. If the FLAGS message is valid, then sending an OK message. Otherwise, log the error and close the websocket.
5. Wait to receive an OK message from the remote node, checking the validity. If the OK message is valid, then consider the ws2p connection completely established. Otherwise, log the error and close the websocket.
3. Wait to receive an ACK message from the remote node, checking the validity. If the ACK message is valid, then sending a SECRET_FLAGS/OK message. Otherwise, log the error and close the websocket.
4. Wait to receive a SECRET_FLAGS/OK message from the remote node, checking the validity. If the message is valid, then sending a SECRET_FLAGS/OK message. Otherwise, log the error and close the websocket. If the receiving message is OK and sending OK message too, skip step 4 and consider the ws2p connection completely established.
5. Wait to receive an OK message from the remote node, checking the validity. If the OK message is valid, then sending an OK message and consider the ws2p connection completely established. Otherwise, log the error and close the websocket.
*timeout : 15 seconds for connection to a conventional endpoint. 30 seconds for connection to a hidden tor service.
For the remote node, only the first step change :
1. Sudden receipt of a CONNECT message. If the CONNECT message is valid, then sending my own CONNECT message and an ACK message at the same time. Otherwise, log the error and close the websocket.
WARNING: independently of all these rules, each implementation must integrate its own anti-spam protections. Any connection can be rejected if the situation requires it (attack by denial of service for example).
### CONNECT message
......@@ -502,14 +506,14 @@ Each node must sign the challenge of the other to prove that it's in possession
challenge := The challenge given by the other node in their CONNECt message.
The message is already signed at the container level, so there is no need to repeat the signature in the ACK message payload. On the other hand, the challenge to be signed must be in the payload.
### FLAGS message
### SECRET FLAGS message
| data name | size in bytes | data type |
|:-------------:|---------------|-----------------|
| flags_size | 1 | u8 |
| flags | flags_size | WS2PSecretFlags |
| member_proof | ? | SigBox |
| member_pubkey | ? | PubkeyBox |
| member_proof | ? | SigBox |
#### WS2PSecretFlags type definition
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment