pub struct TransportManager { /* private fields */ }
Expand description
Transport manager coordinates different transport protocols
Implementations§
Source§impl TransportManager
impl TransportManager
Sourcepub fn new(selection: TransportSelection, options: TransportOptions) -> Self
pub fn new(selection: TransportSelection, options: TransportOptions) -> Self
Create a new transport manager
Sourcepub fn register_transport(&mut self, transport: Arc<dyn Transport>)
pub fn register_transport(&mut self, transport: Arc<dyn Transport>)
Register a transport implementation
Sourcepub async fn connect(&self, addr: &Multiaddr) -> Result<PeerId>
pub async fn connect(&self, addr: &Multiaddr) -> Result<PeerId>
Connect to a peer using the best available transport
Sourcepub async fn connect_with_transport(
&self,
addr: &Multiaddr,
transport_type: TransportType,
) -> Result<PeerId>
pub async fn connect_with_transport( &self, addr: &Multiaddr, transport_type: TransportType, ) -> Result<PeerId>
Connect with specific transport
Sourcepub async fn send_message(&self, peer_id: &PeerId, data: Vec<u8>) -> Result<()>
pub async fn send_message(&self, peer_id: &PeerId, data: Vec<u8>) -> Result<()>
Send message to a peer
Sourcepub async fn get_connection_info(
&self,
peer_id: &PeerId,
) -> Result<ConnectionInfo>
pub async fn get_connection_info( &self, peer_id: &PeerId, ) -> Result<ConnectionInfo>
Get connection info for a peer
Sourcepub async fn get_connection_pool_info(
&self,
peer_id: &PeerId,
) -> Result<ConnectionPoolInfo>
pub async fn get_connection_pool_info( &self, peer_id: &PeerId, ) -> Result<ConnectionPoolInfo>
Get connection pool info
Sourcepub async fn get_connection_pool_stats(
&self,
peer_id: &PeerId,
) -> Result<ConnectionPoolStats>
pub async fn get_connection_pool_stats( &self, peer_id: &PeerId, ) -> Result<ConnectionPoolStats>
Get connection pool statistics
Sourcepub async fn measure_connection_quality(
&self,
peer_id: &PeerId,
) -> Result<ConnectionQuality>
pub async fn measure_connection_quality( &self, peer_id: &PeerId, ) -> Result<ConnectionQuality>
Measure connection quality
Sourcepub async fn switch_transport(
&self,
peer_id: &PeerId,
_new_transport: TransportType,
) -> Result<()>
pub async fn switch_transport( &self, peer_id: &PeerId, _new_transport: TransportType, ) -> Result<()>
Switch transport for a peer
Auto Trait Implementations§
impl Freeze for TransportManager
impl !RefUnwindSafe for TransportManager
impl Send for TransportManager
impl Sync for TransportManager
impl Unpin for TransportManager
impl !UnwindSafe for TransportManager
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