Struct libp2p_mplex::MplexConfig
source · pub struct MplexConfig { /* private fields */ }
Expand description
Configuration for the multiplexer.
Implementations§
source§impl MplexConfig
impl MplexConfig
sourcepub fn new() -> MplexConfig
pub fn new() -> MplexConfig
Builds the default configuration.
sourcepub fn set_max_num_streams(&mut self, max: usize) -> &mut Self
pub fn set_max_num_streams(&mut self, max: usize) -> &mut Self
Sets the maximum number of simultaneously used substreams.
A substream is used as long as it has not been dropped,
even if it may already be closed or reset at the protocol
level (in which case it may still have buffered data that
can be read before the StreamMuxer
API signals EOF).
When the limit is reached, opening of outbound substreams
is delayed until another substream is dropped, whereas new
inbound substreams are immediately answered with a Reset
.
If the number of inbound substreams that need to be reset
accumulates too quickly (judged by internal bounds), the
connection is closed with an error due to the misbehaved
remote.
sourcepub fn set_max_buffer_size(&mut self, max: usize) -> &mut Self
pub fn set_max_buffer_size(&mut self, max: usize) -> &mut Self
Sets the maximum number of frames buffered per substream.
A limit is necessary in order to avoid DoS attacks.
sourcepub fn set_max_buffer_behaviour(
&mut self,
behaviour: MaxBufferBehaviour,
) -> &mut Self
pub fn set_max_buffer_behaviour( &mut self, behaviour: MaxBufferBehaviour, ) -> &mut Self
Sets the behaviour when the maximum buffer size is reached for a substream.
See the documentation of MaxBufferBehaviour
.
sourcepub fn set_split_send_size(&mut self, size: usize) -> &mut Self
pub fn set_split_send_size(&mut self, size: usize) -> &mut Self
Sets the frame size used when sending data. Capped at 1Mbyte as per the Mplex spec.
sourcepub fn set_protocol_name(&mut self, protocol_name: &'static str) -> &mut Self
pub fn set_protocol_name(&mut self, protocol_name: &'static str) -> &mut Self
Set the protocol name.
use libp2p_mplex::MplexConfig;
let mut muxer_config = MplexConfig::new();
muxer_config.set_protocol_name("/mplex/6.7.0");
Trait Implementations§
source§impl Clone for MplexConfig
impl Clone for MplexConfig
source§fn clone(&self) -> MplexConfig
fn clone(&self) -> MplexConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MplexConfig
impl Debug for MplexConfig
source§impl Default for MplexConfig
impl Default for MplexConfig
source§fn default() -> MplexConfig
fn default() -> MplexConfig
source§impl<C> InboundConnectionUpgrade<C> for MplexConfig
impl<C> InboundConnectionUpgrade<C> for MplexConfig
source§impl<C> OutboundConnectionUpgrade<C> for MplexConfig
impl<C> OutboundConnectionUpgrade<C> for MplexConfig
source§impl UpgradeInfo for MplexConfig
impl UpgradeInfo for MplexConfig
§type InfoIter = Once<<MplexConfig as UpgradeInfo>::Info>
type InfoIter = Once<<MplexConfig as UpgradeInfo>::Info>
protocol_info
.source§fn protocol_info(&self) -> Self::InfoIter
fn protocol_info(&self) -> Self::InfoIter
Auto Trait Implementations§
impl Freeze for MplexConfig
impl RefUnwindSafe for MplexConfig
impl Send for MplexConfig
impl Sync for MplexConfig
impl Unpin for MplexConfig
impl UnwindSafe for MplexConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more