sc_network::transport

Function build_transport

Source
pub fn build_transport(
    keypair: Keypair,
    memory_only: bool,
    yamux_window_size: Option<u32>,
    yamux_maximum_buffer_size: usize,
) -> (Boxed<(PeerId, StreamMuxerBox)>, Arc<BandwidthSinks>)
Expand description

Builds the transport that serves as a common ground for all connections.

If memory_only is true, then only communication within the same process are allowed. Only addresses with the format /memory/... are allowed.

yamux_window_size is the maximum size of the Yamux receive windows. None to leave the default (256kiB).

yamux_maximum_buffer_size is the maximum allowed size of the Yamux buffer. This should be set either to the maximum of all the maximum allowed sizes of messages frames of all high-level protocols combined, or to some generously high value if you are sure that a maximum size is enforced on all high-level protocols.

Returns a BandwidthSinks object that allows querying the average bandwidth produced by all the connections spawned with this transport.