Struct libp2p_kad::protocol::KademliaProtocolConfig
source · pub struct KademliaProtocolConfig { /* private fields */ }
Expand description
Configuration for a Kademlia connection upgrade. When applied to a connection, turns this
connection into a Stream + Sink
whose items are of type KadRequestMsg
and KadResponseMsg
.
Implementations§
source§impl KademliaProtocolConfig
impl KademliaProtocolConfig
sourcepub fn protocol_names(&self) -> &[Cow<'static, [u8]>]
pub fn protocol_names(&self) -> &[Cow<'static, [u8]>]
Returns the configured protocol name.
sourcepub fn set_protocol_names(&mut self, names: Vec<Cow<'static, [u8]>>)
pub fn set_protocol_names(&mut self, names: Vec<Cow<'static, [u8]>>)
Modifies the protocol names used on the wire. Can be used to create incompatibilities between networks on purpose.
sourcepub fn set_max_packet_size(&mut self, size: usize)
pub fn set_max_packet_size(&mut self, size: usize)
Modifies the maximum allowed size of a single Kademlia packet.
Trait Implementations§
source§impl Clone for KademliaProtocolConfig
impl Clone for KademliaProtocolConfig
source§fn clone(&self) -> KademliaProtocolConfig
fn clone(&self) -> KademliaProtocolConfig
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for KademliaProtocolConfig
impl Debug for KademliaProtocolConfig
source§impl Default for KademliaProtocolConfig
impl Default for KademliaProtocolConfig
source§impl<C> InboundUpgrade<C> for KademliaProtocolConfigwhere
C: AsyncRead + AsyncWrite + Unpin,
impl<C> InboundUpgrade<C> for KademliaProtocolConfigwhere
C: AsyncRead + AsyncWrite + Unpin,
§type Output = AndThen<With<ErrInto<Framed<C, UviBytes<Cursor<Vec<u8, Global>>>>, Error>, Cursor<Vec<u8, Global>>, KadResponseMsg, Ready<Result<Cursor<Vec<u8, Global>>, Error>>, fn(_: KadResponseMsg) -> Ready<Result<Cursor<Vec<u8, Global>>, Error>>>, Ready<Result<KadRequestMsg, Error>>, fn(_: BytesMut) -> Ready<Result<KadRequestMsg, Error>>>
type Output = AndThen<With<ErrInto<Framed<C, UviBytes<Cursor<Vec<u8, Global>>>>, Error>, Cursor<Vec<u8, Global>>, KadResponseMsg, Ready<Result<Cursor<Vec<u8, Global>>, Error>>, fn(_: KadResponseMsg) -> Ready<Result<Cursor<Vec<u8, Global>>, Error>>>, Ready<Result<KadRequestMsg, Error>>, fn(_: BytesMut) -> Ready<Result<KadRequestMsg, Error>>>
Output after the upgrade has been successfully negotiated and the handshake performed.
§type Future = Ready<Result<<KademliaProtocolConfig as InboundUpgrade<C>>::Output, Error>>
type Future = Ready<Result<<KademliaProtocolConfig as InboundUpgrade<C>>::Output, Error>>
Future that performs the handshake with the remote.
source§impl<C> OutboundUpgrade<C> for KademliaProtocolConfigwhere
C: AsyncRead + AsyncWrite + Unpin,
impl<C> OutboundUpgrade<C> for KademliaProtocolConfigwhere
C: AsyncRead + AsyncWrite + Unpin,
§type Output = AndThen<With<ErrInto<Framed<C, UviBytes<Cursor<Vec<u8, Global>>>>, Error>, Cursor<Vec<u8, Global>>, KadRequestMsg, Ready<Result<Cursor<Vec<u8, Global>>, Error>>, fn(_: KadRequestMsg) -> Ready<Result<Cursor<Vec<u8, Global>>, Error>>>, Ready<Result<KadResponseMsg, Error>>, fn(_: BytesMut) -> Ready<Result<KadResponseMsg, Error>>>
type Output = AndThen<With<ErrInto<Framed<C, UviBytes<Cursor<Vec<u8, Global>>>>, Error>, Cursor<Vec<u8, Global>>, KadRequestMsg, Ready<Result<Cursor<Vec<u8, Global>>, Error>>, fn(_: KadRequestMsg) -> Ready<Result<Cursor<Vec<u8, Global>>, Error>>>, Ready<Result<KadResponseMsg, Error>>, fn(_: BytesMut) -> Ready<Result<KadResponseMsg, Error>>>
Output after the upgrade has been successfully negotiated and the handshake performed.
§type Future = Ready<Result<<KademliaProtocolConfig as OutboundUpgrade<C>>::Output, Error>>
type Future = Ready<Result<<KademliaProtocolConfig as OutboundUpgrade<C>>::Output, Error>>
Future that performs the handshake with the remote.
source§impl UpgradeInfo for KademliaProtocolConfig
impl UpgradeInfo for KademliaProtocolConfig
§type InfoIter = IntoIter<<KademliaProtocolConfig as UpgradeInfo>::Info, Global>
type InfoIter = IntoIter<<KademliaProtocolConfig as UpgradeInfo>::Info, Global>
Iterator returned by
protocol_info
.source§fn protocol_info(&self) -> Self::InfoIter
fn protocol_info(&self) -> Self::InfoIter
Returns the list of protocols that are supported. Used during the negotiation process.
Auto Trait Implementations§
impl RefUnwindSafe for KademliaProtocolConfig
impl Send for KademliaProtocolConfig
impl Sync for KademliaProtocolConfig
impl Unpin for KademliaProtocolConfig
impl UnwindSafe for KademliaProtocolConfig
Blanket Implementations§
source§impl<C, U> InboundUpgradeExt<C> for Uwhere
U: InboundUpgrade<C>,
impl<C, U> InboundUpgradeExt<C> for Uwhere
U: InboundUpgrade<C>,
source§fn map_inbound<F, T>(self, f: F) -> MapInboundUpgrade<Self, F>where
Self: Sized,
F: FnOnce(Self::Output) -> T,
fn map_inbound<F, T>(self, f: F) -> MapInboundUpgrade<Self, F>where
Self: Sized,
F: FnOnce(Self::Output) -> T,
Returns a new object that wraps around
Self
and applies a closure to the Output
.source§fn map_inbound_err<F, T>(self, f: F) -> MapInboundUpgradeErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> T,
fn map_inbound_err<F, T>(self, f: F) -> MapInboundUpgradeErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> T,
Returns a new object that wraps around
Self
and applies a closure to the Error
.source§impl<C, U> OutboundUpgradeExt<C> for Uwhere
U: OutboundUpgrade<C>,
impl<C, U> OutboundUpgradeExt<C> for Uwhere
U: OutboundUpgrade<C>,
source§fn map_outbound<F, T>(self, f: F) -> MapOutboundUpgrade<Self, F>where
Self: Sized,
F: FnOnce(Self::Output) -> T,
fn map_outbound<F, T>(self, f: F) -> MapOutboundUpgrade<Self, F>where
Self: Sized,
F: FnOnce(Self::Output) -> T,
Returns a new object that wraps around
Self
and applies a closure to the Output
.source§fn map_outbound_err<F, T>(self, f: F) -> MapOutboundUpgradeErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> T,
fn map_outbound_err<F, T>(self, f: F) -> MapOutboundUpgradeErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> T,
Returns a new object that wraps around
Self
and applies a closure to the Error
.