Transport¶
Overview¶
Purpose¶
The Transport engine is responsible for sending and receiving messages from other nodes over the network, establishing and maintaining authenticated and encrypted communication channels to other nodes via various transport protocols.
State¶
The Transport engine maintains a ConnectionPool, a pool of open connections associated with node identities of connected nodes. For protocols that support session resumption (such as QUIC, TLS), it also maintains a TransportSessionCache for this purpose.
Messages received¶
P2PMessage¶
An outgoing message to be delivered to another node over the network.
Reception:
Record with fields:
src
: NodeIdentity
Source peer
dst
: NodeIdentity
Destination peer
msg
: enum { EngineMessageV1, RelayMessageV1 }
Encapsulated message
sig
: Signature
Signature over the above fields by src
Triggers:
TransportMessage¶
A message from/to one of the transport protocols.
Reception:
Record with fields:
addr
: TransportAddress
Source or destination address
tprefs
: Option<TransportPrefs>
Transport preferences for outgoing messages
expiry
: Option
Expiry time for outgoing messages
msg
: P2PMessageV1
Encapsulated message
Triggers:
ConnectRequest¶
Establish connection to a node.
Reception:
Triggers:
Result
DisconnectRequest¶
Establish disconnection to a node.
Reception:
Triggers:
Result
ConnectedNodesRequest¶
Request the list of currently connected nodes.
Reception:
unit
Triggers:
list<(NodeIdentity, TransportAddress)>
Notifications sent¶
NodeConnected¶
Notification sent when a transport connection is established to a node.
NodeConnectFailed¶
Notification sent when a transport connection is closed to a node.
NodeDisconnected¶
Notification sent when failed to establish a connection to a node.
Message flow¶
sequenceDiagram
TransportProtocol -) Transport: TransportMessage
Transport -) Router: P2PMessage
Router -) Transport: P2PMessage
Transport -) TransportProtocol: TransportMessage
Topology ->>+ Transport: ConnectRequest
Transport -->>- Topology: ConnectResponse
Topology ->>+ Transport: DisconnectRequest
Transport -->>- Topology: DisconnectResponse
Any Local Engine ->>+ Transport: ConnectedNodesRequest
Transport -->>- Any Local Engine: ConnectedNodesResponse
Transport -) Any Local Engine: NodeConnected
Transport -) Any Local Engine: NodeDisconnected
Transport -) Any Local Engine: NodeConnectFailed
(Wiki) links on this page
- Transport
- NodeIdentity
- P2PMessage to Transport
- P2PMessageV1
- NodeIdentity
- NodeIdentity
- EngineMessageV1
- RelayMessageV1
- TransportMessage
- TransportMessage
- TransportMessageV1
- TransportAddress
- TransportPrefs
- P2PMessageV1
- P2PMessage
- ConnectRequest
- ConnectRequestV1
- NodeIdentity
- ConnectResponseV1
- DisconnectRequest
- DisconnectRequestV1
- NodeIdentity
- DisconnectResponseV1
- ConnectedNodesRequest
- ConnectedNodesResponseV1
- NodeIdentity
- TransportAddress
- NodeConnected
- NodeTransportAddress
- NodeIdentity
- TransportAddress
- NodeConnectFailed
- NodeTransportAddress
- NodeIdentity
- TransportAddress
- NodeDisconnected
- NodeTransportAddress
- NodeIdentity
- TransportAddress