pub struct Mesh { /* private fields */ }Expand description
High-level mesh controller used by clients.
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub async fn new(identity: Identity, config: MeshConfig) -> Result<Self>
pub async fn new(identity: Identity, config: MeshConfig) -> Result<Self>
Create a new mesh instance bound to the configured UDP port. This spawns background tasks for receiving, candidate checks, rekeying, scaling decisions, and ping-based link stats.
Sourcepub fn local_peer_id(&self) -> PeerId
pub fn local_peer_id(&self) -> PeerId
Return the local peer id.
Sourcepub async fn local_addr(&self) -> Result<SocketAddr>
pub async fn local_addr(&self) -> Result<SocketAddr>
Return the local UDP listen address.
Sourcepub fn start_lan_discovery(&mut self) -> Result<()>
pub fn start_lan_discovery(&mut self) -> Result<()>
Start LAN discovery via mDNS and spawn the discovery task.
Sourcepub async fn enable_nat(&mut self, nat_cfg: NatConfig)
pub async fn enable_nat(&mut self, nat_cfg: NatConfig)
Enable NAT traversal (STUN + TURN) and populate local candidates.
Sourcepub async fn join_invite(
&mut self,
invite: Invite,
nat_cfg: NatConfig,
) -> Result<()>
pub async fn join_invite( &mut self, invite: Invite, nat_cfg: NatConfig, ) -> Result<()>
Join peers from an invite using NAT traversal for connectivity.
Sourcepub async fn active_session(&self) -> SessionId
pub async fn active_session(&self) -> SessionId
Return the currently active session id.
Sourcepub async fn next_event(&mut self) -> Option<MeshEvent>
pub async fn next_event(&mut self) -> Option<MeshEvent>
Await the next mesh event.
Sourcepub fn handle(&self) -> MeshHandle
pub fn handle(&self) -> MeshHandle
Obtain a cloneable handle for issuing commands.
Auto Trait Implementations§
impl Freeze for Mesh
impl !RefUnwindSafe for Mesh
impl Send for Mesh
impl Sync for Mesh
impl Unpin for Mesh
impl !UnwindSafe for Mesh
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
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