pub struct FipsEndpoint { /* private fields */ }Expand description
A running embedded FIPS endpoint.
Implementations§
Source§impl FipsEndpoint
impl FipsEndpoint
Sourcepub fn builder() -> FipsEndpointBuilder
pub fn builder() -> FipsEndpointBuilder
Create a builder for an embedded endpoint.
Sourcepub fn address(&self) -> FipsAddress
pub fn address(&self) -> FipsAddress
Local FIPS IPv6-compatible address.
Sourcepub fn discovery_scope(&self) -> Option<&str>
pub fn discovery_scope(&self) -> Option<&str>
Application-level discovery scope, if configured.
Sourcepub async fn send_batch_to_peer(
&self,
remote: PeerIdentity,
payloads: Vec<Vec<u8>>,
) -> Result<(), FipsEndpointError>
pub async fn send_batch_to_peer( &self, remote: PeerIdentity, payloads: Vec<Vec<u8>>, ) -> Result<(), FipsEndpointError>
Send application-owned endpoint payloads to one resolved peer.
This is the canonical endpoint-data send path for applications that
already validate and cache peer identities in their own routing table.
It avoids per-packet npub allocation, endpoint cache lookup, and
PeerIdentity::from_npub parsing while preserving owned-payload
semantics.
Sourcepub async fn recv_batch_into(
&self,
messages: &mut Vec<FipsEndpointMessage>,
max: usize,
) -> Option<usize>
pub async fn recv_batch_into( &self, messages: &mut Vec<FipsEndpointMessage>, max: usize, ) -> Option<usize>
Receive one endpoint message, then drain ready follow-ons into a caller-owned buffer.
This is the receive-side counterpart to Self::send_batch_to_peer:
callers still get individual source-attributed messages, but a hot
dataplane consumer can amortize the endpoint receiver lock, task wake,
and message buffer allocation across a bounded burst.
Sourcepub fn blocking_send_batch_to_peer(
&self,
remote: PeerIdentity,
payloads: Vec<Vec<u8>>,
) -> Result<(), FipsEndpointError>
pub fn blocking_send_batch_to_peer( &self, remote: PeerIdentity, payloads: Vec<Vec<u8>>, ) -> Result<(), FipsEndpointError>
Synchronous blocking batch send to one resolved remote identity.
This is the blocking-thread counterpart to Self::send_batch_to_peer.
The caller keeps routing authority: FIPS only receives already-owned
endpoint payloads for the resolved peer.
Sourcepub fn blocking_recv_batch_into(
&self,
messages: &mut Vec<FipsEndpointMessage>,
max: usize,
) -> Option<usize>
pub fn blocking_recv_batch_into( &self, messages: &mut Vec<FipsEndpointMessage>, max: usize, ) -> Option<usize>
Synchronous blocking batch receive into a caller-owned buffer.
This is the blocking-thread counterpart to Self::recv_batch_into:
it parks the calling OS thread for the first message, then drains
ready follow-ons while holding the endpoint receiver lock. MUST NOT be
called from inside a tokio runtime; use this only from a dedicated
blocking thread.
Sourcepub async fn update_peers(
&self,
peers: Vec<PeerConfig>,
) -> Result<UpdatePeersOutcome, FipsEndpointError>
pub async fn update_peers( &self, peers: Vec<PeerConfig>, ) -> Result<UpdatePeersOutcome, FipsEndpointError>
Replace the runtime peer list. Newly added auto-connect peers get
dialed immediately using every known address (overlay-fresh first,
then operator/cache hints). Removed peers are dropped from the
retry queue but stay connected if they currently are — the regular
liveness timeout reaps idle sessions. Existing entries get their
addresses field refreshed so the next retry sees the latest hints.
Pass an empty addresses vector for a peer if you want fips to
resolve them entirely from the Nostr advert at dial time.
Sourcepub async fn refresh_peer_paths(
&self,
peers: Vec<PeerIdentity>,
) -> Result<usize, FipsEndpointError>
pub async fn refresh_peer_paths( &self, peers: Vec<PeerIdentity>, ) -> Result<usize, FipsEndpointError>
Force immediate direct-path refresh attempts for configured peers.
Unlike FipsEndpoint::update_peers, this does not require a config
diff. It asks the running node to race a fresh direct handshake for the
supplied active peers while preserving existing sessions and routes.
Sourcepub async fn peers(&self) -> Result<Vec<FipsEndpointPeer>, FipsEndpointError>
pub async fn peers(&self) -> Result<Vec<FipsEndpointPeer>, FipsEndpointError>
Snapshot authenticated peers known by the endpoint.
Sourcepub async fn local_advertised_endpoints(
&self,
) -> Result<Vec<OverlayEndpointAdvert>, FipsEndpointError>
pub async fn local_advertised_endpoints( &self, ) -> Result<Vec<OverlayEndpointAdvert>, FipsEndpointError>
Snapshot the endpoint addresses this node is currently advertising via Nostr discovery.
Sourcepub async fn relay_statuses(
&self,
) -> Result<Vec<FipsEndpointRelayStatus>, FipsEndpointError>
pub async fn relay_statuses( &self, ) -> Result<Vec<FipsEndpointRelayStatus>, FipsEndpointError>
Snapshot live Nostr relay states used by the embedded endpoint.
Sourcepub async fn update_relays(
&self,
advert_relays: Vec<String>,
dm_relays: Vec<String>,
) -> Result<(), FipsEndpointError>
pub async fn update_relays( &self, advert_relays: Vec<String>, dm_relays: Vec<String>, ) -> Result<(), FipsEndpointError>
Replace Nostr discovery relays without rebuilding the endpoint.
Sourcepub async fn send_ip_packet(
&self,
packet: impl Into<Vec<u8>>,
) -> Result<(), FipsEndpointError>
pub async fn send_ip_packet( &self, packet: impl Into<Vec<u8>>, ) -> Result<(), FipsEndpointError>
Send an outbound IPv6 packet into the FIPS session pipeline.
Sourcepub async fn recv_ip_packet(&self) -> Option<NodeDeliveredPacket>
pub async fn recv_ip_packet(&self) -> Option<NodeDeliveredPacket>
Receive the next source-attributed IPv6 packet delivered by FIPS.
Sourcepub async fn shutdown(&self) -> Result<(), FipsEndpointError>
pub async fn shutdown(&self) -> Result<(), FipsEndpointError>
Shut down the endpoint and wait for the node task to stop.
Trait Implementations§
Source§impl Drop for FipsEndpoint
impl Drop for FipsEndpoint
Auto Trait Implementations§
impl !Freeze for FipsEndpoint
impl !RefUnwindSafe for FipsEndpoint
impl !UnwindSafe for FipsEndpoint
impl Send for FipsEndpoint
impl Sync for FipsEndpoint
impl Unpin for FipsEndpoint
impl UnsafeUnpin for FipsEndpoint
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
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>
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