pub struct Node { /* private fields */ }Implementations§
Source§impl Node
impl Node
Sourcepub fn control_signal(&self) -> Arc<Notify> ⓘ
pub fn control_signal(&self) -> Arc<Notify> ⓘ
Poll at most eight queued requests, dropping expired requests. No workspace membership is implied; the peer is derived from the TLS connection. Raised once per queued control request. It carries no data; the caller still polls to learn what arrived.
Sourcepub fn has_deferred_controls(&self) -> bool
pub fn has_deferred_controls(&self) -> bool
True while requests set aside by poll_control_matching wait.
Sourcepub fn rearm_control_signal(&self)
pub fn rearm_control_signal(&self)
Wake the host for requests already queued, for example ones set aside while a membership commit was pending. Arrivals raise this themselves.
pub fn poll_control(&mut self) -> Option<ControlRequest>
Sourcepub fn set_inquiry_responder(&self, responder: InquiryResponder)
pub fn set_inquiry_responder(&self, responder: InquiryResponder)
Answer inquiries from committed state before they reach the host queue.
Sourcepub fn connection_capacity(&self) -> CapacityCounts
pub fn connection_capacity(&self) -> CapacityCounts
Connections closed to make room or refused, device-wide.
Sourcepub fn control_timing(&self) -> ControlTiming
pub fn control_timing(&self) -> ControlTiming
Where control requests spent their time since this node started.
Sourcepub fn poll_control_matching(
&mut self,
matches: impl Fn(&[u8]) -> bool,
) -> Option<ControlRequest>
pub fn poll_control_matching( &mut self, matches: impl Fn(&[u8]) -> bool, ) -> Option<ControlRequest>
Find a request without consuming unrelated control traffic. Used while a membership commit is pending so admission intake can continue without reordering recovery or membership-control messages.
Sourcepub fn poll_control_first(
&mut self,
matches: impl Fn(&[u8]) -> bool,
depth: usize,
) -> Option<ControlRequest>
pub fn poll_control_first( &mut self, matches: impl Fn(&[u8]) -> bool, depth: usize, ) -> Option<ControlRequest>
Take the first matching request from up to depth newly queued ones
plus those already set aside; the rest keep their order. For short
requests that must not wait behind a long queue (ADR 0009).
pub fn control_client(&self) -> ControlClient
Source§impl Node
impl Node
pub fn transport_metrics(&self) -> TransportMetrics
Sourcepub async fn bind(address: SocketAddr) -> Result<(Self, MessageReceiver), Error>
pub async fn bind(address: SocketAddr) -> Result<(Self, MessageReceiver), Error>
Bind a directly reachable local address. Public discovery, relays and port mapping are disabled. Fresh identity on every bind in this version.
Sourcepub async fn bind_with_identity(
address: SocketAddr,
secret: &[u8; 32],
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_with_identity( address: SocketAddr, secret: &[u8; 32], ) -> Result<(Self, MessageReceiver), Error>
Bind using a caller-owned, securely generated and stored 32-byte endpoint credential. This restores transport identity only, never workspace authority. The caller must prevent concurrent endpoint instances using this credential.
Sourcepub async fn bind_lan(
address: SocketAddr,
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_lan( address: SocketAddr, ) -> Result<(Self, MessageReceiver), Error>
Opt in to local-network address advertisement/lookup. This publishes the endpoint key and addresses, never workspace names or membership authority. Public lookup services and relay transports remain disabled.
Sourcepub async fn bind_lan_with_identity(
address: SocketAddr,
secret: &[u8; 32],
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_lan_with_identity( address: SocketAddr, secret: &[u8; 32], ) -> Result<(Self, MessageReceiver), Error>
Opt in to LAN lookup while retaining a workspace-scoped endpoint identity. Advertises this endpoint key and addresses, never membership authority.
Sourcepub async fn bind_nearby_with_identity(
address: SocketAddr,
secret: &[u8; 32],
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_nearby_with_identity( address: SocketAddr, secret: &[u8; 32], ) -> Result<(Self, MessageReceiver), Error>
Local device-level invitation discovery, isolated from workspace endpoint discovery.
Sourcepub async fn bind_wan_with_identity(
address: SocketAddr,
secret: &[u8; 32],
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_wan_with_identity( address: SocketAddr, secret: &[u8; 32], ) -> Result<(Self, MessageReceiver), Error>
Opt in to Iroh’s public Pkarr address lookup and relay network while retaining LAN lookup. These services provide routes, never membership.
Sourcepub async fn bind_relay_with_identity(
address: SocketAddr,
secret: &[u8; 32],
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_relay_with_identity( address: SocketAddr, secret: &[u8; 32], ) -> Result<(Self, MessageReceiver), Error>
Diagnostic WAN profile that forces authenticated traffic through Iroh relays while leaving the device’s Wi-Fi connection intact.
Sourcepub async fn bind_wan_only_with_identity(
address: SocketAddr,
secret: &[u8; 32],
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_wan_only_with_identity( address: SocketAddr, secret: &[u8; 32], ) -> Result<(Self, MessageReceiver), Error>
Diagnostic WAN profile that uses only public endpoint lookup and ignores LAN discovery and saved IP hints while retaining direct Iroh paths.
Sourcepub async fn bind_with_profile(
address: SocketAddr,
secret: Option<&[u8; 32]>,
profile: NetworkProfile,
budget: ConnectionBudget,
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_with_profile( address: SocketAddr, secret: Option<&[u8; 32]>, profile: NetworkProfile, budget: ConnectionBudget, ) -> Result<(Self, MessageReceiver), Error>
Bind an independently identified endpoint using host-owned shared device capacity. Clone the same budget for each workspace and discovery endpoint.
Sourcepub async fn bind_with_profile_and_relay(
address: SocketAddr,
secret: Option<&[u8; 32]>,
profile: NetworkProfile,
budget: ConnectionBudget,
relay: RelayOptions,
) -> Result<(Self, MessageReceiver), Error>
pub async fn bind_with_profile_and_relay( address: SocketAddr, secret: Option<&[u8; 32]>, profile: NetworkProfile, budget: ConnectionBudget, relay: RelayOptions, ) -> Result<(Self, MessageReceiver), Error>
Bind with a caller-supplied relay map and TLS trust configuration.
This is intended for controlled relay qualification and operator-managed
relay deployments. The caller must select NetworkProfile::RelayOnly
when direct paths must be excluded.
pub fn id(&self) -> PeerId
Sourcepub fn control_cancellation(&self) -> Sender<bool>
pub fn control_cancellation(&self) -> Sender<bool>
A session-local cancellation latch for outbound control exchanges.
Sourcepub fn poll_membership_gossip(&self) -> Option<(WorkspaceId, Vec<u8>)>
pub fn poll_membership_gossip(&self) -> Option<(WorkspaceId, Vec<u8>)>
Next membership step received by gossip, as (workspace, opaque bytes). Delivered without a policy revision check (ADR 0008): the caller must verify the step itself against its own saved state before using it.
Sourcepub async fn wait_for_membership_gossip(
&self,
workspace: WorkspaceId,
) -> Option<Vec<u8>>
pub async fn wait_for_membership_gossip( &self, workspace: WorkspaceId, ) -> Option<Vec<u8>>
Wait for one queued membership envelope for workspace.
The caller owns the deadline; no polling interval is introduced here.
Sourcepub fn broadcast_membership(
&self,
workspace: WorkspaceId,
payload: Vec<u8>,
) -> impl Future<Output = Result<bool, Error>> + Send + 'static
pub fn broadcast_membership( &self, workspace: WorkspaceId, payload: Vec<u8>, ) -> impl Future<Output = Result<bool, Error>> + Send + 'static
Broadcast a committed membership step on the workspace overlay’s reserved membership topic. Owned so the host can spawn it. Ok(false) means no overlay or no remote member to send to.
pub fn address(&self) -> SocketAddr
Sourcepub async fn wait_online(&self)
pub async fn wait_online(&self)
Wait until the endpoint has an active relay connection.
This is only needed by callers that explicitly selected a relay-only profile. It is event-driven and does not add a polling delay or fallback.
pub fn resources(&self) -> ResourceTransfers
Sourcepub async fn network_change(&self)
pub async fn network_change(&self)
Android cannot detect host network changes from native code. The Java connectivity callback must forward them so Iroh can rebind its sockets.
pub async fn add_address_hint( &self, peer: PeerId, address: SocketAddr, ) -> Result<(), Error>
Sourcepub async fn remember_observed(&self, peer: PeerId, address: SocketAddr)
pub async fn remember_observed(&self, peer: PeerId, address: SocketAddr)
Remember an authenticated return path without synchronously changing any workspace gossip overlay. Control-plane observations use this narrow path so a presence reply cannot wait on peer discovery.
Sourcepub async fn address_hint(&self, peer: PeerId) -> Option<SocketAddr>
pub async fn address_hint(&self, peer: PeerId) -> Option<SocketAddr>
A cached route is only a hint. Callers must separately authorize any workspace metadata they share with it.
Sourcepub async fn nearby_peers(&self) -> Vec<PeerId>
pub async fn nearby_peers(&self) -> Vec<PeerId>
Endpoints passively observed on the application-named local mDNS service. These are route hints only and carry no workspace or human identity claim.
Sourcepub async fn nearby_workspace_peers(&self) -> Vec<PeerId>
pub async fn nearby_workspace_peers(&self) -> Vec<PeerId>
Return a bounded batch for workspace advertisement queries.
Sourcepub async fn install_verified_policy(
&self,
workspace: WorkspaceId,
revision: u64,
endpoint_permissions: BTreeMap<PeerId, Permissions>,
) -> Result<(), Error>
pub async fn install_verified_policy( &self, workspace: WorkspaceId, revision: u64, endpoint_permissions: BTreeMap<PeerId, Permissions>, ) -> Result<(), Error>
Trusted application seam. Never invoke with an unverified network policy. The caller resolves member/device bindings into endpoint permissions; this module neither establishes those bindings nor verifies admin authority.
Sourcepub async fn enable_gossip(
&self,
workspace: WorkspaceId,
revision: u64,
) -> Result<(), Error>
pub async fn enable_gossip( &self, workspace: WorkspaceId, revision: u64, ) -> Result<(), Error>
Enable one bounded workspace-wide live overlay after installing a verified policy. Direct-recipient publications keep their acknowledged path.
Sourcepub async fn with_routing_policy<T>(
&self,
inspect: impl FnOnce(&RoutingTable) -> T,
) -> T
pub async fn with_routing_policy<T>( &self, inspect: impl FnOnce(&RoutingTable) -> T, ) -> T
Read the current routing policy under the same lock used for data routing. The callback must be bounded, synchronous and must not reenter this node. Owned results may leave the lock; policy references cannot escape it.
Sourcepub async fn live_neighbor_count(&self, workspace: WorkspaceId) -> usize
pub async fn live_neighbor_count(&self, workspace: WorkspaceId) -> usize
Current maintained live neighbors for a workspace overlay. Zero means no overlay or no connected neighbor; it is not a workspace member count.
Sourcepub async fn live_neighbors(&self, workspace: WorkspaceId) -> Vec<PeerId>
pub async fn live_neighbors(&self, workspace: WorkspaceId) -> Vec<PeerId>
Authenticated direct neighbors in the bounded workspace Gossip view. These are advisory retrieval candidates, not proof that history exists.
Sourcepub async fn wait_for_gossip_neighbor(&self, workspace: WorkspaceId) -> bool
pub async fn wait_for_gossip_neighbor(&self, workspace: WorkspaceId) -> bool
Wait for the native Gossip overlay to observe at least one neighbor. The caller owns the deadline; no polling interval is introduced here.
pub async fn subscribe( &self, workspace: WorkspaceId, revision: u64, topic: Topic, ) -> Result<AdmissionReport, Error>
pub async fn unsubscribe( &self, workspace: WorkspaceId, revision: u64, topic: Topic, ) -> Result<AdmissionReport, Error>
Sourcepub async fn prepare_interest(
&self,
workspace: WorkspaceId,
revision: u64,
topic: Topic,
subscribe: bool,
) -> Result<impl Future<Output = Result<AdmissionReport, Error>> + Send + 'static, Error>
pub async fn prepare_interest( &self, workspace: WorkspaceId, revision: u64, topic: Topic, subscribe: bool, ) -> Result<impl Future<Output = Result<AdmissionReport, Error>> + Send + 'static, Error>
Apply local interest before returning an owned remote announcement. Hosts may schedule this future without holding their session lock. They must serialize announcements; dropping one does not undo local interest.
pub async fn publish( &self, workspace: WorkspaceId, revision: u64, topic: Topic, payload: Vec<u8>, ) -> Result<AdmissionReport, Error>
pub async fn publish_with_class( &self, workspace: WorkspaceId, revision: u64, topic: Topic, delivery: DeliveryClass, payload: Vec<u8>, ) -> Result<AdmissionReport, Error>
Sourcepub async fn publish_to(
&self,
workspace: WorkspaceId,
revision: u64,
topic: Topic,
endpoints: Vec<PeerId>,
recipients: Vec<[u8; 32]>,
payload: Vec<u8>,
) -> Result<AdmissionReport, Error>
pub async fn publish_to( &self, workspace: WorkspaceId, revision: u64, topic: Topic, endpoints: Vec<PeerId>, recipients: Vec<[u8; 32]>, payload: Vec<u8>, ) -> Result<AdmissionReport, Error>
Send to authorized subscribers within the resolved audience. Each selected endpoint without announced interest gets a non-admission result.