pub struct NatTraversalEndpoint { /* private fields */ }Expand description
High-level NAT traversal endpoint for Autonomi P2P networks
Implementations§
Source§impl NatTraversalEndpoint
impl NatTraversalEndpoint
Sourcepub fn new(
config: NatTraversalConfig,
event_callback: Option<Box<dyn Fn(NatTraversalEvent) + Send + Sync>>,
) -> Result<Self, NatTraversalError>
pub fn new( config: NatTraversalConfig, event_callback: Option<Box<dyn Fn(NatTraversalEvent) + Send + Sync>>, ) -> Result<Self, NatTraversalError>
Create a new NAT traversal endpoint with optional event callback
Sourcepub fn initiate_nat_traversal(
&self,
peer_id: PeerId,
coordinator: SocketAddr,
) -> Result<(), NatTraversalError>
pub fn initiate_nat_traversal( &self, peer_id: PeerId, coordinator: SocketAddr, ) -> Result<(), NatTraversalError>
Initiate NAT traversal to a peer (returns immediately, progress via events)
Sourcepub fn get_statistics(
&self,
) -> Result<NatTraversalStatistics, NatTraversalError>
pub fn get_statistics( &self, ) -> Result<NatTraversalStatistics, NatTraversalError>
Get current NAT traversal statistics
Sourcepub fn add_bootstrap_node(
&self,
address: SocketAddr,
) -> Result<(), NatTraversalError>
pub fn add_bootstrap_node( &self, address: SocketAddr, ) -> Result<(), NatTraversalError>
Add a new bootstrap node
Sourcepub fn remove_bootstrap_node(
&self,
address: SocketAddr,
) -> Result<(), NatTraversalError>
pub fn remove_bootstrap_node( &self, address: SocketAddr, ) -> Result<(), NatTraversalError>
Remove a bootstrap node
Sourcepub fn poll(
&self,
now: Instant,
) -> Result<Vec<NatTraversalEvent>, NatTraversalError>
pub fn poll( &self, now: Instant, ) -> Result<Vec<NatTraversalEvent>, NatTraversalError>
Poll for NAT traversal progress and state machine updates
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NatTraversalEndpoint
impl !RefUnwindSafe for NatTraversalEndpoint
impl Send for NatTraversalEndpoint
impl Sync for NatTraversalEndpoint
impl Unpin for NatTraversalEndpoint
impl !UnwindSafe for NatTraversalEndpoint
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