Skip to content

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:

P2PMessageV1

Record with fields:

Source peer

Destination peer

Encapsulated message

  • sig: Signature

Signature over the above fields by src

Triggers:

TransportMessage

TransportMessage

A message from/to one of the transport protocols.

Reception:

TransportMessageV1

Record with fields:

Source or destination address

Transport preferences for outgoing messages

  • expiry: Option

Expiry time for outgoing messages

Encapsulated message

Triggers:

P2PMessage

ConnectRequest

Establish connection to a node.

Reception:

ConnectRequestV1

Record with fields:

Node to connect to.

Triggers:

ConnectResponseV1

Result

DisconnectRequest

Establish disconnection to a node.

Reception:

DisconnectRequestV1

Record with fields:

Node to disconnect from.

Triggers:

DisconnectResponseV1

Result

ConnectedNodesRequest

Request the list of currently connected nodes.

Reception:

unit

Triggers:

ConnectedNodesResponseV1

Notifications sent

NodeConnected

Notification sent when a transport connection is established to a node.

NodeTransportAddress

Record with fields:

Node ID

Transport address of node

NodeConnectFailed

Notification sent when a transport connection is closed to a node.

NodeTransportAddress

Record with fields:

Node ID

Transport address of node

NodeDisconnected

Notification sent when failed to establish a connection to a node.

NodeTransportAddress

Record with fields:

Node ID

Transport address of 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