Struct DefaultMessageRouter
pub struct DefaultMessageRouter<G, L, ES>where
G: Deref<Target = NetworkGraph<L>>,
L: Deref,
ES: Deref,
<L as Deref>::Target: Logger,
<ES as Deref>::Target: EntropySource,{ /* private fields */ }
Expand description
A MessageRouter
that can only route to a directly connected Destination
.
§Privacy
Creating BlindedMessagePath
s may affect privacy since, if a suitable path cannot be found,
it will create a one-hop path using the recipient as the introduction node if it is a announced
node. Otherwise, there is no way to find a path to the introduction node in order to send a
message, and thus an Err
is returned.
Implementations§
§impl<G, L, ES> DefaultMessageRouter<G, L, ES>where
G: Deref<Target = NetworkGraph<L>>,
L: Deref,
ES: Deref,
<L as Deref>::Target: Logger,
<ES as Deref>::Target: EntropySource,
impl<G, L, ES> DefaultMessageRouter<G, L, ES>where
G: Deref<Target = NetworkGraph<L>>,
L: Deref,
ES: Deref,
<L as Deref>::Target: Logger,
<ES as Deref>::Target: EntropySource,
pub fn new(
network_graph: G,
entropy_source: ES,
) -> DefaultMessageRouter<G, L, ES>
pub fn new( network_graph: G, entropy_source: ES, ) -> DefaultMessageRouter<G, L, ES>
Creates a DefaultMessageRouter
using the given NetworkGraph
.
Trait Implementations§
§impl<G, L, ES> MessageRouter for DefaultMessageRouter<G, L, ES>where
G: Deref<Target = NetworkGraph<L>>,
L: Deref,
ES: Deref,
<L as Deref>::Target: Logger,
<ES as Deref>::Target: EntropySource,
impl<G, L, ES> MessageRouter for DefaultMessageRouter<G, L, ES>where
G: Deref<Target = NetworkGraph<L>>,
L: Deref,
ES: Deref,
<L as Deref>::Target: Logger,
<ES as Deref>::Target: EntropySource,
§fn find_path(
&self,
sender: PublicKey,
peers: Vec<PublicKey>,
destination: Destination,
) -> Result<OnionMessagePath, ()>
fn find_path( &self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination, ) -> Result<OnionMessagePath, ()>
Returns a route for sending an
OnionMessage
to the given Destination
.§fn create_blinded_paths<T>(
&self,
recipient: PublicKey,
context: MessageContext,
peers: Vec<PublicKey>,
secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedMessagePath>, ()>where
T: Signing + Verification,
fn create_blinded_paths<T>(
&self,
recipient: PublicKey,
context: MessageContext,
peers: Vec<PublicKey>,
secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedMessagePath>, ()>where
T: Signing + Verification,
Creates
BlindedMessagePath
s to the recipient
node. The nodes in peers
are assumed to
be direct peers with the recipient
.§fn create_compact_blinded_paths<T>(
&self,
recipient: PublicKey,
context: MessageContext,
peers: Vec<MessageForwardNode>,
secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedMessagePath>, ()>where
T: Signing + Verification,
fn create_compact_blinded_paths<T>(
&self,
recipient: PublicKey,
context: MessageContext,
peers: Vec<MessageForwardNode>,
secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedMessagePath>, ()>where
T: Signing + Verification,
Creates compact
BlindedMessagePath
s to the recipient
node. The nodes in peers
are
assumed to be direct peers with the recipient
. Read moreAuto Trait Implementations§
impl<G, L, ES> Freeze for DefaultMessageRouter<G, L, ES>
impl<G, L, ES> RefUnwindSafe for DefaultMessageRouter<G, L, ES>where
G: RefUnwindSafe,
ES: RefUnwindSafe,
impl<G, L, ES> Send for DefaultMessageRouter<G, L, ES>
impl<G, L, ES> Sync for DefaultMessageRouter<G, L, ES>
impl<G, L, ES> Unpin for DefaultMessageRouter<G, L, ES>
impl<G, L, ES> UnwindSafe for DefaultMessageRouter<G, L, ES>where
G: UnwindSafe,
ES: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request