Expand description
§The signalling server implementation
This structure implements a signalling server.
It communicates using WSSignalMessageToNode and WSSignalMessageFromNode messages
with the nodes.
§Node connection to the signalling server
If a node wants to connect to the signalling server, it needs to prove it holds the private key corresponding to its public key by signing a random message sent by the signalling server:
- Server sends
WSSignalMessageToNode::Challengewith the current version of the server and a 256-bit random challenge - Node sends
WSSignalMessageFromNode::Announcecontaining theMessageAnnouncewith the node-information and a signature of the challenge - Server sends
WSSignalMessageToNode::ListIDsReplyif the signature has been verified successfully, else it waits for another announce-message
§WebRTC signalling setup
Once a node has been connected to the signalling server, other nodes can start a
WebRTC connection with it.
For this, the nodes will send several WSSignalMessageFromNode::PeerSetup messages
that the signalling server will redirect to the other node.
These messages contain the PeerInfo and the [crate::web_rtc::messages::PeerMessage] needed to setup a WebRTC connection.
One of the nodes is the initializer, while the other is the follower:
- Initializer sends a [
crate::web_rtc::messages::PeerMessage::Init] to the follower - The follower answers with a [
crate::web_rtc::messages::PeerMessage::Offer] containing information necessary for the setup of the connection - The initializer uses the offer to start its connection and replies with a
[
crate::web_rtc::messages::PeerMessage::Answer], also containing information for the setting up of the connection
Once the first message has been sent, both nodes will start to exchange
[crate::web_rtc::messages::PeerMessage::IceCandidate] messages which contain information
about possible connection candidates between the two nodes.
These messages will even continue once the connection has been setup, and can be used for
example to create a nice handover when the network connection changes.
After the connections are set up, only the IceCandidate messages are exchanged between the
nodes.
§Usage of the signalling server
You can find an example of how the signalling server is used in https://github.com/ineiti/fledger/tree/0.7.0/cli/flsignal/src/main.rs
Structs§
- Fledger
Config - Message
Announce - What a node sends when it connects to the signalling server
- Node
Stat - Some statistics about the connections to other nodes.
- Signal
Config - Signal
Server - This implements a signalling server. It can be used for tests, in the cli implementation, and will also be used later directly in the network struct to allow for direct node-node setups.
Enums§
- Signal
In - Messages for the signalling server
- Signal
Out - Messages sent by the signalling server to an eventual listener
- WSSignal
Message From Node - A message coming from a node
- WSSignal
Message ToNode - Message is a list of messages to be sent between the node and the signal server.
Constants§
- SIGNAL_
VERSION - Our current version - will change if the API is incompatible.