Struct libp2p::core::transport::upgrade::Builder [−][src]
A Builder facilitates upgrading of a Transport for use with
a Network.
The upgrade process is defined by the following stages:
authenticate{1}
-> apply{*}
-> multiplex{1}
It thus enforces the following invariants on every transport
obtained from multiplex:
- The transport must be authenticated and multiplexed.
- Authentication must precede the negotiation of a multiplexer.
- Applying a multiplexer is the last step in the upgrade process.
- The
Transport::Outputconforms to the requirements of aNetwork, namely a tuple of aPeerId(from the authentication upgrade) and aStreamMuxer(from the multiplexing upgrade).
Implementations
impl<T> Builder<T> where
T: Transport,
<T as Transport>::Error: 'static, [src]
T: Transport,
<T as Transport>::Error: 'static,
pub fn new(inner: T, version: Version) -> Builder<T>[src]
Creates a Builder over the given (base) Transport.
pub fn authenticate<C, D, U, E>(
self,
upgrade: U
) -> Authenticated<AndThen<T, impl FnOnce(C, ConnectedPoint) + Clone>> where
C: AsyncRead + AsyncWrite + Unpin,
E: Error + 'static,
T: Transport<Output = C>,
U: InboundUpgrade<Negotiated<C>, Output = (PeerId, D), Error = E> + OutboundUpgrade<Negotiated<C>, Output = (PeerId, D), Error = E> + Clone,
D: AsyncRead + AsyncWrite + Unpin, [src]
self,
upgrade: U
) -> Authenticated<AndThen<T, impl FnOnce(C, ConnectedPoint) + Clone>> where
C: AsyncRead + AsyncWrite + Unpin,
E: Error + 'static,
T: Transport<Output = C>,
U: InboundUpgrade<Negotiated<C>, Output = (PeerId, D), Error = E> + OutboundUpgrade<Negotiated<C>, Output = (PeerId, D), Error = E> + Clone,
D: AsyncRead + AsyncWrite + Unpin,
Upgrades the transport to perform authentication of the remote.
The supplied upgrade receives the I/O resource C and must
produce a pair (PeerId, D), where D is a new I/O resource.
The upgrade must thus at a minimum identify the remote, which typically
involves the use of a cryptographic authentication protocol in the
context of establishing a secure channel.
Transitions
- I/O upgrade:
C -> (PeerId, D). - Transport output:
C -> (PeerId, D)
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Builder<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Builder<T> where
T: Send,
T: Send,
impl<T> Sync for Builder<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Builder<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Builder<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>, [src]
V: MultiLane<T>,