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]>, Global>)
pub fn set_protocol_names(&mut self, names: Vec<Cow<'static, [u8]>, Global>)
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§fn default() -> KademliaProtocolConfig
fn default() -> KademliaProtocolConfig
Returns the “default value” for a type. Read more
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§fn upgrade_inbound(
self,
incoming: C,
_: <KademliaProtocolConfig as UpgradeInfo>::Info
) -> <KademliaProtocolConfig as InboundUpgrade<C>>::Future
fn upgrade_inbound( self, incoming: C, _: <KademliaProtocolConfig as UpgradeInfo>::Info ) -> <KademliaProtocolConfig as InboundUpgrade<C>>::Future
After we have determined that the remote supports one of the protocols we support, this
method is called to start the handshake. Read more
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§fn upgrade_outbound(
self,
incoming: C,
_: <KademliaProtocolConfig as UpgradeInfo>::Info
) -> <KademliaProtocolConfig as OutboundUpgrade<C>>::Future
fn upgrade_outbound( self, incoming: C, _: <KademliaProtocolConfig as UpgradeInfo>::Info ) -> <KademliaProtocolConfig as OutboundUpgrade<C>>::Future
After we have determined that the remote supports one of the protocols we support, this
method is called to start the handshake. Read more
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) -> <KademliaProtocolConfig as UpgradeInfo>::InfoIter
fn protocol_info(&self) -> <KademliaProtocolConfig as UpgradeInfo>::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<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
Mutably borrows from an owned value. Read more
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<T, TInfo> InboundUpgradeSend for Twhere
T: InboundUpgrade<Negotiated<SubstreamBox>, Info = TInfo> + UpgradeInfoSend<Info = TInfo>,
TInfo: ProtocolName + Clone + Send + 'static,
<T as InboundUpgrade<Negotiated<SubstreamBox>>>::Output: Send + 'static,
<T as InboundUpgrade<Negotiated<SubstreamBox>>>::Error: Send + 'static,
<T as InboundUpgrade<Negotiated<SubstreamBox>>>::Future: Send + 'static,
impl<T, TInfo> InboundUpgradeSend for Twhere T: InboundUpgrade<Negotiated<SubstreamBox>, Info = TInfo> + UpgradeInfoSend<Info = TInfo>, TInfo: ProtocolName + Clone + Send + 'static, <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Output: Send + 'static, <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Error: Send + 'static, <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Future: Send + 'static,
§type Output = <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Output
type Output = <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Output
Equivalent to
InboundUpgrade::Output
.§type Error = <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Error
type Error = <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Error
Equivalent to
InboundUpgrade::Error
.§type Future = <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Future
type Future = <T as InboundUpgrade<Negotiated<SubstreamBox>>>::Future
Equivalent to
InboundUpgrade::Future
.source§fn upgrade_inbound(
self,
socket: Negotiated<SubstreamBox>,
info: TInfo
) -> <T as InboundUpgradeSend>::Future
fn upgrade_inbound( self, socket: Negotiated<SubstreamBox>, info: TInfo ) -> <T as InboundUpgradeSend>::Future
Equivalent to
InboundUpgrade::upgrade_inbound
.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<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
.source§impl<T, TInfo> OutboundUpgradeSend for Twhere
T: OutboundUpgrade<Negotiated<SubstreamBox>, Info = TInfo> + UpgradeInfoSend<Info = TInfo>,
TInfo: ProtocolName + Clone + Send + 'static,
<T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Output: Send + 'static,
<T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Error: Send + 'static,
<T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Future: Send + 'static,
impl<T, TInfo> OutboundUpgradeSend for Twhere T: OutboundUpgrade<Negotiated<SubstreamBox>, Info = TInfo> + UpgradeInfoSend<Info = TInfo>, TInfo: ProtocolName + Clone + Send + 'static, <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Output: Send + 'static, <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Error: Send + 'static, <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Future: Send + 'static,
§type Output = <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Output
type Output = <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Output
Equivalent to
OutboundUpgrade::Output
.§type Error = <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Error
type Error = <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Error
Equivalent to
OutboundUpgrade::Error
.§type Future = <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Future
type Future = <T as OutboundUpgrade<Negotiated<SubstreamBox>>>::Future
Equivalent to
OutboundUpgrade::Future
.source§fn upgrade_outbound(
self,
socket: Negotiated<SubstreamBox>,
info: TInfo
) -> <T as OutboundUpgradeSend>::Future
fn upgrade_outbound( self, socket: Negotiated<SubstreamBox>, info: TInfo ) -> <T as OutboundUpgradeSend>::Future
Equivalent to
OutboundUpgrade::upgrade_outbound
.source§impl<T> UpgradeInfoSend for Twhere
T: UpgradeInfo + Send + 'static,
<T as UpgradeInfo>::Info: Send + 'static,
<<T as UpgradeInfo>::InfoIter as IntoIterator>::IntoIter: Send + 'static,
impl<T> UpgradeInfoSend for Twhere T: UpgradeInfo + Send + 'static, <T as UpgradeInfo>::Info: Send + 'static, <<T as UpgradeInfo>::InfoIter as IntoIterator>::IntoIter: Send + 'static,
§type Info = <T as UpgradeInfo>::Info
type Info = <T as UpgradeInfo>::Info
Equivalent to
UpgradeInfo::Info
.§type InfoIter = <<T as UpgradeInfo>::InfoIter as IntoIterator>::IntoIter
type InfoIter = <<T as UpgradeInfo>::InfoIter as IntoIterator>::IntoIter
Equivalent to
UpgradeInfo::InfoIter
.source§fn protocol_info(&self) -> <T as UpgradeInfoSend>::InfoIter
fn protocol_info(&self) -> <T as UpgradeInfoSend>::InfoIter
Equivalent to
UpgradeInfo::protocol_info
.