pub struct RelayManager { /* private fields */ }Expand description
Manages relay connections for NAT traversal
Implementations§
Source§impl RelayManager
impl RelayManager
Sourcepub fn new(config: RelayManagerConfig) -> Self
pub fn new(config: RelayManagerConfig) -> Self
Create a new relay manager with the given configuration
Sourcepub fn config(&self) -> &RelayManagerConfig
pub fn config(&self) -> &RelayManagerConfig
Get the configuration
Sourcepub fn remove_relay(&mut self, address: &Multiaddr) -> Option<RelayInfo>
pub fn remove_relay(&mut self, address: &Multiaddr) -> Option<RelayInfo>
Remove a relay address
Sourcepub fn get_relay_mut(&mut self, address: &Multiaddr) -> Option<&mut RelayInfo>
pub fn get_relay_mut(&mut self, address: &Multiaddr) -> Option<&mut RelayInfo>
Get mutable relay info by address
Sourcepub fn get_relay_by_peer(&self, peer_id: &PeerId) -> Option<&RelayInfo>
pub fn get_relay_by_peer(&self, peer_id: &PeerId) -> Option<&RelayInfo>
Get relay info by peer ID
Sourcepub fn get_relay_by_peer_mut(
&mut self,
peer_id: &PeerId,
) -> Option<&mut RelayInfo>
pub fn get_relay_by_peer_mut( &mut self, peer_id: &PeerId, ) -> Option<&mut RelayInfo>
Get mutable relay info by peer ID
Sourcepub fn relay_addresses(&self) -> impl Iterator<Item = &Multiaddr>
pub fn relay_addresses(&self) -> impl Iterator<Item = &Multiaddr>
Get all relay addresses
Sourcepub fn active_relay_addresses(&self) -> impl Iterator<Item = &Multiaddr>
pub fn active_relay_addresses(&self) -> impl Iterator<Item = &Multiaddr>
Get all active relay addresses
Sourcepub fn active_relay_count(&self) -> usize
pub fn active_relay_count(&self) -> usize
Get number of active relays
Sourcepub fn needs_more_relays(&self) -> bool
pub fn needs_more_relays(&self) -> bool
Check if we need more relay connections
Sourcepub fn relays_to_connect(&self) -> Vec<Multiaddr>
pub fn relays_to_connect(&self) -> Vec<Multiaddr>
Get relays that should be (re)connected
Sourcepub fn mark_connecting(&mut self, address: &Multiaddr)
pub fn mark_connecting(&mut self, address: &Multiaddr)
Mark a relay as connecting
Sourcepub fn mark_connected(&mut self, address: &Multiaddr, peer_id: PeerId)
pub fn mark_connected(&mut self, address: &Multiaddr, peer_id: PeerId)
Mark a relay as connected
Sourcepub fn mark_failed(&mut self, address: &Multiaddr, reason: String)
pub fn mark_failed(&mut self, address: &Multiaddr, reason: String)
Mark a relay as failed
Sourcepub fn mark_listening(&mut self, peer_id: &PeerId, circuit_address: Multiaddr)
pub fn mark_listening(&mut self, peer_id: &PeerId, circuit_address: Multiaddr)
Mark a relay as listening (p2p-circuit address active)
Sourcepub fn circuit_addresses(&self) -> Vec<Multiaddr>
pub fn circuit_addresses(&self) -> Vec<Multiaddr>
Get all p2p-circuit addresses we’re listening on
Sourcepub fn stats(&self) -> RelayStats
pub fn stats(&self) -> RelayStats
Get statistics about relay connections
Auto Trait Implementations§
impl Freeze for RelayManager
impl RefUnwindSafe for RelayManager
impl Send for RelayManager
impl Sync for RelayManager
impl Unpin for RelayManager
impl UnwindSafe for RelayManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more