pub struct MeshControl { /* private fields */ }Expand description
A cloneable control handle to a running mesh — everything that talks to the mesh thread over
the command channel (peers, endpoints, handshakes, send, status), but not the inbound packet
stream. Because it carries no receiver it is freely Clone/Send/Sync, so several owners can
drive one mesh: e.g. a status UI and a chat loop sharing a single set of tunnels. Obtain one from
MeshService::control.
Implementations§
Source§impl MeshControl
impl MeshControl
Sourcepub fn add_peer(
&self,
peer_id: &str,
peer_pubkey_hex: &str,
endpoint: Option<SocketAddr>,
) -> Result<SocketAddr, String>
pub fn add_peer( &self, peer_id: &str, peer_pubkey_hex: &str, endpoint: Option<SocketAddr>, ) -> Result<SocketAddr, String>
Add a peer; returns the local socket address the tunnel bound.
Sourcepub fn set_peer_endpoint(
&self,
peer_id: &str,
addr: SocketAddr,
) -> Result<(), String>
pub fn set_peer_endpoint( &self, peer_id: &str, addr: SocketAddr, ) -> Result<(), String>
Point a peer’s tunnel at addr.
Sourcepub fn initiate_handshake(&self, peer_id: &str) -> Result<(), String>
pub fn initiate_handshake(&self, peer_id: &str) -> Result<(), String>
Start the handshake with a peer (initiator side; endpoint must be set).
Sourcepub fn send(&self, peer_id: &str, inner: Vec<u8>) -> Result<bool, String>
pub fn send(&self, peer_id: &str, inner: Vec<u8>) -> Result<bool, String>
Encrypt and send one inner IPv6 packet to a peer.
Sourcepub fn remove_peer(&self, peer_id: &str) -> Result<bool, String>
pub fn remove_peer(&self, peer_id: &str) -> Result<bool, String>
Remove a peer; returns whether it was present.
Sourcepub fn has_session(&self, peer_id: &str) -> Result<bool, String>
pub fn has_session(&self, peer_id: &str) -> Result<bool, String>
Whether a live session exists with a peer.
Sourcepub fn wait_for_session(&self, peer_id: &str, timeout: Duration) -> bool
pub fn wait_for_session(&self, peer_id: &str, timeout: Duration) -> bool
Poll until a session is established with peer_id, or timeout elapses.
Trait Implementations§
Source§impl Clone for MeshControl
impl Clone for MeshControl
Source§fn clone(&self) -> MeshControl
fn clone(&self) -> MeshControl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MeshControl
impl RefUnwindSafe for MeshControl
impl Send for MeshControl
impl Sync for MeshControl
impl Unpin for MeshControl
impl UnsafeUnpin for MeshControl
impl UnwindSafe for MeshControl
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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