pub struct IrohEndpoint { /* private fields */ }Expand description
A shared Iroh endpoint.
Clone-able (cheap Arc clone). All fetch and serve calls on the same node share one endpoint and therefore one stable QUIC identity.
Implementations§
Source§impl IrohEndpoint
impl IrohEndpoint
Sourcepub async fn bind(opts: NodeOptions) -> Result<Self, CoreError>
pub async fn bind(opts: NodeOptions) -> Result<Self, CoreError>
Bind an Iroh endpoint with the supplied options.
Sourcepub fn max_consecutive_errors(&self) -> usize
pub fn max_consecutive_errors(&self) -> usize
The configured consecutive-error limit for the serve loop.
Sourcepub fn serve_options(&self) -> ServeOptions
pub fn serve_options(&self) -> ServeOptions
Build a [ServeOptions] from the endpoint’s stored configuration.
Platform adapters should call this instead of constructing ServeOptions
manually so that all server-limit fields are forwarded consistently.
Sourcepub fn secret_key_bytes(&self) -> [u8; 32]
pub fn secret_key_bytes(&self) -> [u8; 32]
The node’s raw secret key bytes (32 bytes).
Sourcepub async fn close(&self)
pub async fn close(&self)
Graceful close: signal the serve loop to stop accepting, wait for in-flight requests to drain (up to the configured drain timeout), then close the QUIC endpoint.
If no serve loop is running, closes the endpoint immediately.
The handle store (all registries) is freed when the last IrohEndpoint
clone is dropped — no explicit unregister is needed.
Sourcepub async fn close_force(&self)
pub async fn close_force(&self)
Immediate close: abort the serve loop and close the endpoint with no drain period.
Sourcepub async fn wait_closed(&self)
pub async fn wait_closed(&self)
Wait until this endpoint has been closed (either explicitly via close() /
close_force(), or because the native QUIC stack shut down).
Returns immediately if already closed.
Sourcepub fn set_serve_handle(&self, handle: ServeHandle)
pub fn set_serve_handle(&self, handle: ServeHandle)
Store a serve handle so that close() can drain it.
Sourcepub fn stop_serve(&self)
pub fn stop_serve(&self)
Signal the serve loop to stop accepting new connections.
Returns immediately — does NOT close the endpoint or drain in-flight
requests. The handle is preserved so close() can still drain later.
Sourcepub async fn wait_serve_stop(&self)
pub async fn wait_serve_stop(&self)
Wait until the serve loop has fully exited (serve task drained and finished).
Returns immediately if serve() was never called.
pub fn raw(&self) -> &Endpoint
Sourcepub fn handles(&self) -> &HandleStore
pub fn handles(&self) -> &HandleStore
Per-endpoint handle store.
Sourcepub fn max_header_size(&self) -> usize
pub fn max_header_size(&self) -> usize
Maximum byte size of an HTTP/1.1 head.
Sourcepub fn endpoint_stats(&self) -> EndpointStats
pub fn endpoint_stats(&self) -> EndpointStats
Snapshot of current endpoint statistics.
All fields are point-in-time reads and may change between calls.
Sourcepub fn compression(&self) -> Option<&CompressionOptions>
pub fn compression(&self) -> Option<&CompressionOptions>
Compression options, if the compression feature is enabled.
Sourcepub fn bound_sockets(&self) -> Vec<SocketAddr>
pub fn bound_sockets(&self) -> Vec<SocketAddr>
Returns the local socket addresses this endpoint is bound to.
Sourcepub fn node_addr(&self) -> NodeAddrInfo
pub fn node_addr(&self) -> NodeAddrInfo
Full node address: node ID + relay URL(s) + direct socket addresses.
Sourcepub fn home_relay(&self) -> Option<String>
pub fn home_relay(&self) -> Option<String>
Home relay URL, or None if not connected to a relay.
Sourcepub async fn peer_info(&self, node_id_b32: &str) -> Option<NodeAddrInfo>
pub async fn peer_info(&self, node_id_b32: &str) -> Option<NodeAddrInfo>
Known addresses for a remote peer, or None if not in the endpoint’s cache.
Sourcepub async fn peer_stats(&self, node_id_b32: &str) -> Option<PeerStats>
pub async fn peer_stats(&self, node_id_b32: &str) -> Option<PeerStats>
Per-peer connection statistics.
Returns path information for each known transport address, including whether each path is via a relay or direct, and which is active.
Trait Implementations§
Source§impl Clone for IrohEndpoint
impl Clone for IrohEndpoint
Source§fn clone(&self) -> IrohEndpoint
fn clone(&self) -> IrohEndpoint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more