P2pLinkTransport

Struct P2pLinkTransport 

Source
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

Source

pub async fn new(config: P2pConfig) -> Result<Self, EndpointError>

Create a new LinkTransport from a P2pConfig.

Source

pub fn from_endpoint(endpoint: Arc<P2pEndpoint>) -> Self

Create from an existing P2pEndpoint.

Source

pub fn endpoint(&self) -> &P2pEndpoint

Get the underlying P2pEndpoint.

Trait Implementations§

Source§

impl LinkTransport for P2pLinkTransport

Source§

type Conn = P2pLinkConn

The connection type returned by this transport.
Source§

fn local_peer(&self) -> PeerId

Get our local peer identity. Read more
Source§

fn external_address(&self) -> Option<SocketAddr>

Get our externally observed address, if known. Read more
Source§

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>

Get capabilities for a specific peer. Read more
Source§

fn subscribe(&self) -> Receiver<LinkEvent>

Subscribe to transport-level events. Read more
Source§

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>>

Dial a peer by their PeerId (preferred method). Read more
Source§

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>

Get protocols we advertise as supported.
Source§

fn register_protocol(&self, proto: ProtocolId)

Register a protocol as supported. Read more
Source§

fn unregister_protocol(&self, proto: ProtocolId)

Unregister a protocol. Read more
Source§

fn is_connected(&self, peer: &PeerId) -> bool

Check if we have an active connection to a peer.
Source§

fn active_connections(&self) -> usize

Get the count of active connections.
Source§

fn shutdown(&self) -> BoxFuture<'_, ()>

Gracefully shutdown the transport. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more