pub struct Mplex<C> {
pub la: Multiaddr,
pub ra: Multiaddr,
pub local_priv_key: Keypair,
pub local_peer_id: PeerId,
pub remote_pub_key: PublicKey,
pub remote_peer_id: PeerId,
/* private fields */
}Expand description
A Mplex connection.
This implementation isn’t capable of detecting when the underlying socket changes its address,
and no [StreamMuxerEvent::AddressChange] event is ever emitted.
Fields§
§la: MultiaddrThe secure&connection info provided by underlying socket. The socket is moved into Connection, so we have to make a copy of these information
The local multiaddr of this connection
ra: MultiaddrThe remote multiaddr of this connection
local_priv_key: KeypairThe private key of the local
local_peer_id: PeerIdFor convenience, the local peer ID, generated from local pub key
remote_pub_key: PublicKeyThe public key of the remote.
remote_peer_id: PeerIdFor convenience, put a PeerId here, which is actually calculated from remote_key
Implementations§
Source§impl<C: ConnectionInfo + SecureInfo + AsyncRead + AsyncWrite + Send + Unpin + 'static> Mplex<C>
impl<C: ConnectionInfo + SecureInfo + AsyncRead + AsyncWrite + Send + Unpin + 'static> Mplex<C>
Trait Implementations§
Source§impl<C: Send> ConnectionInfo for Mplex<C>
impl<C: Send> ConnectionInfo for Mplex<C>
fn local_multiaddr(&self) -> Multiaddr
fn remote_multiaddr(&self) -> Multiaddr
Source§impl<C> SecureInfo for Mplex<C>
impl<C> SecureInfo for Mplex<C>
fn local_peer(&self) -> PeerId
fn remote_peer(&self) -> PeerId
fn local_priv_key(&self) -> Keypair
fn remote_pub_key(&self) -> PublicKey
Source§impl<C: AsyncRead + AsyncWrite + Send + Unpin + 'static> StreamMuxer for Mplex<C>
impl<C: AsyncRead + AsyncWrite + Send + Unpin + 'static> StreamMuxer for Mplex<C>
Source§fn open_stream<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<IReadWrite, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_stream<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<IReadWrite, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Opens a new outgoing substream.
Source§fn accept_stream<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<IReadWrite, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn accept_stream<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<IReadWrite, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Accepts a new incoming substream.
Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Closes the stream muxer, the runtime of stream muxer will then exit.
Source§fn task(&mut self) -> Option<BoxFuture<'static, ()>>
fn task(&mut self) -> Option<BoxFuture<'static, ()>>
Returns a Future which represents the main loop of the stream muxer.
Source§fn box_clone(&self) -> IStreamMuxer
fn box_clone(&self) -> IStreamMuxer
Returns the cloned Trait object.
impl<C: AsyncRead + AsyncWrite + Send + Unpin + 'static> StreamMuxerEx for Mplex<C>
Auto Trait Implementations§
impl<C> Freeze for Mplex<C>
impl<C> !RefUnwindSafe for Mplex<C>
impl<C> Send for Mplex<C>where
C: Send,
impl<C> Sync for Mplex<C>where
C: Send,
impl<C> Unpin for Mplex<C>
impl<C> !UnwindSafe for Mplex<C>
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