Skip to main content

FipsEndpoint

Struct FipsEndpoint 

Source
pub struct FipsEndpoint { /* private fields */ }
Expand description

A running embedded FIPS endpoint.

Implementations§

Source§

impl FipsEndpoint

Source

pub fn builder() -> FipsEndpointBuilder

Create a builder for an embedded endpoint.

Source

pub fn npub(&self) -> &str

Local endpoint npub.

Source

pub fn node_addr(&self) -> &NodeAddr

Local FIPS node address.

Source

pub fn address(&self) -> FipsAddress

Local FIPS IPv6-compatible address.

Source

pub fn discovery_scope(&self) -> Option<&str>

Application-level discovery scope, if configured.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn peers(&self) -> Result<Vec<FipsEndpointPeer>, FipsEndpointError>

Snapshot authenticated peers known by the endpoint.

Source

pub async fn local_advertised_endpoints( &self, ) -> Result<Vec<OverlayEndpointAdvert>, FipsEndpointError>

Snapshot the endpoint addresses this node is currently advertising via Nostr discovery.

Source

pub async fn relay_statuses( &self, ) -> Result<Vec<FipsEndpointRelayStatus>, FipsEndpointError>

Snapshot live Nostr relay states used by the embedded endpoint.

Source

pub async fn update_relays( &self, advert_relays: Vec<String>, dm_relays: Vec<String>, ) -> Result<(), FipsEndpointError>

Replace Nostr discovery relays without rebuilding the endpoint.

Source

pub async fn send_ip_packet( &self, packet: impl Into<Vec<u8>>, ) -> Result<(), FipsEndpointError>

Send an outbound IPv6 packet into the FIPS session pipeline.

Source

pub async fn recv_ip_packet(&self) -> Option<NodeDeliveredPacket>

Receive the next source-attributed IPv6 packet delivered by FIPS.

Source

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

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more