You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contact - a node that is explicitly allowed to connect to a node
distance - smallest number of edges (direct connections) connecting two nodes
0.ii Format
"2. Message Types" is formated as follows:
'name' (Type 'number')
Request (opt)
Byte
0-a
a-(a+b)
...
Content
Data A
Data B
...
Data type
Type of Data A
Type of Data B
...
Response (opt)
Byte
0-a
a-(a+b)
...
Content
Data A
Data B
...
Data type
Type of Data A
Type of Data B
...
(opt)
Description, Use Cases and Reaction
'name' (Type 'number'.'number') (opt)
Same as any Message Type (opt)
1. Base Data Envelope
Byte
0-1
2
3
4-n
Content
Length of Type Data
ID
Type
Type Data
Data type
UInt16
UInt8
UInt8
The ID here is used only within each connection, it is used primarly to indicate what we respond to.
2. Message Types
Response (Type 0)
Byte
0-n
Content
Message
Data type
A response to a message, its Message and reaction is specified in the Response part of the Message Type. Its ID in the Base Data Envelope is the same as the message it responds to.
Direct (Type 1)
Byte
0-n
Content
Message
Data type
A direct message to the connected node, its Message and reaction depends on the application.
Config (Type 2)
Byte
0
1-n
Content
SubType
connection options
Data type
UInt8
data from subtype
A message concerning the configuration of the connection.
JSON config (Type 2.0)
Byte
0-n
Content
connection options
Data type
JSON
Options
maxBandwidth (excluding direct)
id (this node)
messageTypes (array)
standardVersions (array)
Initializing a connection
Both nodes send their settings as JSON (maxBandwidth; id (this node); messageTypes; standardVersions)
The node acting as the server sends all of their distances via messages type 2.3, the other node changes their distances accordingly, if its distance is more than 2 smaller,
then it sends its distance (type 2.1)
maxBandwidth (excluding direct)
sets how much data can be sent within a second (excluding direct messages)
One node sends their preferred bandwidth
The other node saves it
The lower Max bandwidth of the contacts is used
messageTypes
Only the message types that both nodes support are used
standardVersions
The newest version that both nodes Support is used
Distance (Type 2.1)
Byte
0-15
16
Content
UUID
Distance (FF for removed)
Data type
UUID
UInt8
Used to tell contacts its distance to a node (sent on change), react as follows:
If any contact has a distance equal to or lower than your own
Set own distance one higher than lowest of neighbors (if over limit remove)
Else
Send message type 2.2 to your contacts (excluding contact whose distance changed/was excluded)
Set own distance one higher than the lowest response (if over limit remove)
Distance without self (Type 2.2)
Request:
Byte
0-15
Content
UUID
Data type
UUID
Response:
Byte
0
Content
Distance
Data type
UInt8
Used to calculate distance, react as follows:
Get new distance (excluding the contact, that asked) (see Type 2.1)
Respond with that distance (if over limit respond with FF)
Distance Sync (Type 2.3)
Byte
0-15
16
17-32
33
...
Content
UUID
Distance (FF for removed)
UUID
Distance (FF for removed)
...
Data type
UUID
UInt8
UUID
UInt8
...
Sent at the start of a connection. Sent repeatedly as needed.
Broadcast (Type 3)
Request:
Byte
0
1
2-n
Content
TTL
SubType
SubType Data
Data type
UInt8
UInt8
Response:
Byte
0-1
2-n
n-(n+2)
(n+2)-m
...
Content
Length of response a
Response a
Length of response b
Response b
...
Data type
UInt16
Response
UInt16
Response
...
Broadcasts are forwarded to all contacts with a decremented TTL as long as TTL is bigger than 0.
A node responds with all unique response it got plus its own.
If the same message is received a short time after the first time getting it (has the same hash), it is ignored (empty response).
A TTL limit (>3) may be set to reduce traffic, if a message has a higher TTL, it is forwarded, with the TTL set one lower than the limit.
Route (Type 4)
Request:
Byte
0
1-16
17
18-n
Content
TTL
Receiver
SubType
SubType Data
Data type
UInt8
UUID
UInt8
Response:
Byte
0-n
n-m
Content
Signature of response
Response
Data type
Signature
Response
Individual Response on failure
Byte
0
Content
Status
Data type
UInt8
If the receiver is a connected contact, this is forwarded to it, else if it has a distance this is forwarded to n amount of contacts (<4) whith a lower distance at random, otherwise it's forwarded to all connected contacts with TTL decremented as long TTL is bigger than 0.
An empty response means that TTL reached 0 before getting to the Receiver, a node responds with all unique response it got.
If the same message is received a short time after the first time getting it (has the same hash), it is ignored (empty response).
A TTL limit (>3) may be set to reduce traffic, if a message has a higher TTL, it is forwarded, with the TTL set one lower than the limit.