pub struct P2pLinkTransport { /* private fields */ }Expand description
A LinkTransport implementation wrapping P2pEndpoint.
This provides a stable abstraction layer for overlay networks to use, decoupling them from specific ant-quic versions.
Implementations§
Source§impl P2pLinkTransport
impl P2pLinkTransport
Sourcepub async fn new(config: P2pConfig) -> Result<Self, EndpointError>
pub async fn new(config: P2pConfig) -> Result<Self, EndpointError>
Create a new LinkTransport from a P2pConfig.
Sourcepub fn from_endpoint(endpoint: Arc<P2pEndpoint>) -> Self
pub fn from_endpoint(endpoint: Arc<P2pEndpoint>) -> Self
Create from an existing P2pEndpoint.
Sourcepub fn endpoint(&self) -> &P2pEndpoint
pub fn endpoint(&self) -> &P2pEndpoint
Get the underlying P2pEndpoint.
Trait Implementations§
Source§impl LinkTransport for P2pLinkTransport
impl LinkTransport for P2pLinkTransport
Source§type Conn = P2pLinkConn
type Conn = P2pLinkConn
The connection type returned by this transport.
Source§fn local_peer(&self) -> PeerId
fn local_peer(&self) -> PeerId
Get our local peer identity. Read more
Source§fn external_address(&self) -> Option<SocketAddr>
fn external_address(&self) -> Option<SocketAddr>
Get our externally observed address, if known. Read more
Source§fn peer_table(&self) -> Vec<(PeerId, Capabilities)>
fn peer_table(&self) -> Vec<(PeerId, Capabilities)>
Get all known peers with their capabilities. Read more
Source§fn peer_capabilities(&self, peer: &PeerId) -> Option<Capabilities>
fn peer_capabilities(&self, peer: &PeerId) -> Option<Capabilities>
Get capabilities for a specific peer. Read more
Source§fn accept(&self, _proto: ProtocolId) -> Incoming<Self::Conn>
fn accept(&self, _proto: ProtocolId) -> Incoming<Self::Conn>
Accept incoming connections for a specific protocol. Read more
Source§fn dial(
&self,
peer: PeerId,
_proto: ProtocolId,
) -> BoxFuture<'_, LinkResult<Self::Conn>>
fn dial( &self, peer: PeerId, _proto: ProtocolId, ) -> BoxFuture<'_, LinkResult<Self::Conn>>
Dial a peer by their PeerId (preferred method). Read more
Source§fn dial_addr(
&self,
addr: SocketAddr,
_proto: ProtocolId,
) -> BoxFuture<'_, LinkResult<Self::Conn>>
fn dial_addr( &self, addr: SocketAddr, _proto: ProtocolId, ) -> BoxFuture<'_, LinkResult<Self::Conn>>
Dial a peer by direct address (for bootstrapping). Read more
Source§fn supported_protocols(&self) -> Vec<ProtocolId>
fn supported_protocols(&self) -> Vec<ProtocolId>
Get protocols we advertise as supported.
Source§fn register_protocol(&self, proto: ProtocolId)
fn register_protocol(&self, proto: ProtocolId)
Register a protocol as supported. Read more
Source§fn unregister_protocol(&self, proto: ProtocolId)
fn unregister_protocol(&self, proto: ProtocolId)
Unregister a protocol. Read more
Source§fn is_connected(&self, peer: &PeerId) -> bool
fn is_connected(&self, peer: &PeerId) -> bool
Check if we have an active connection to a peer.
Source§fn active_connections(&self) -> usize
fn active_connections(&self) -> usize
Get the count of active connections.
Auto Trait Implementations§
impl Freeze for P2pLinkTransport
impl !RefUnwindSafe for P2pLinkTransport
impl Send for P2pLinkTransport
impl Sync for P2pLinkTransport
impl Unpin for P2pLinkTransport
impl !UnwindSafe for P2pLinkTransport
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