pub struct OnionClient { /* private fields */ }
Expand description
Onion client that is responsible for announcing our DHT PublicKey
to our
friends and looking for their DHT PublicKey
s.
Implementations§
Source§impl OnionClient
impl OnionClient
Sourcepub fn new(
dht: DhtServer,
tcp_connections: TcpConnections,
real_sk: SecretKey,
real_pk: PublicKey,
) -> Self
pub fn new( dht: DhtServer, tcp_connections: TcpConnections, real_sk: SecretKey, real_pk: PublicKey, ) -> Self
Create new OnionClient
.
Sourcepub async fn set_dht_pk_sink(
&self,
dht_pk_tx: UnboundedSender<(PublicKey, PublicKey)>,
)
pub async fn set_dht_pk_sink( &self, dht_pk_tx: UnboundedSender<(PublicKey, PublicKey)>, )
Set sink to send DHT PublicKey
when it gets known.
Sourcepub async fn set_friend_request_sink(
&self,
friend_request_sink: UnboundedSender<(PublicKey, FriendRequest)>,
)
pub async fn set_friend_request_sink( &self, friend_request_sink: UnboundedSender<(PublicKey, FriendRequest)>, )
Set sink to receive FriendRequest
s.
Sourcepub async fn handle_announce_response(
&self,
packet: &OnionAnnounceResponse,
is_global: bool,
) -> Result<(), HandleAnnounceResponseError>
pub async fn handle_announce_response( &self, packet: &OnionAnnounceResponse, is_global: bool, ) -> Result<(), HandleAnnounceResponseError>
Handle OnionAnnounceResponse
packet.
Sourcepub async fn handle_dht_pk_announce(
&self,
friend_pk: PublicKey,
dht_pk_announce: DhtPkAnnouncePayload,
) -> Result<(), HandleDhtPkAnnounceError>
pub async fn handle_dht_pk_announce( &self, friend_pk: PublicKey, dht_pk_announce: DhtPkAnnouncePayload, ) -> Result<(), HandleDhtPkAnnounceError>
Handle DHT PublicKey
announce from both onion and DHT.
Sourcepub async fn handle_data_response(
&self,
packet: &OnionDataResponse,
) -> Result<(), HandleDataResponseError>
pub async fn handle_data_response( &self, packet: &OnionDataResponse, ) -> Result<(), HandleDataResponseError>
Handle OnionDataResponse
packet.
Sourcepub async fn add_path_node(&self, node: PackedNode)
pub async fn add_path_node(&self, node: PackedNode)
Add new node to random nodes pool to use them to build random paths.
Sourcepub async fn add_friend(&self, real_pk: PublicKey)
pub async fn add_friend(&self, real_pk: PublicKey)
Add a friend to start looking for its DHT PublicKey
.
Sourcepub async fn remove_friend(&self, real_pk: PublicKey)
pub async fn remove_friend(&self, real_pk: PublicKey)
Remove a friend and stop looking for him.
Sourcepub async fn set_friend_connected(&self, real_pk: PublicKey, connected: bool)
pub async fn set_friend_connected(&self, real_pk: PublicKey, connected: bool)
Set connection status of a friend. If he’s connected we can stop looking
for his DHT PublicKey
.
Sourcepub async fn set_friend_dht_pk(&self, real_pk: PublicKey, dht_pk: PublicKey)
pub async fn set_friend_dht_pk(&self, real_pk: PublicKey, dht_pk: PublicKey)
Set friend’s DHT PublicKey
when it gets known somewhere else.
Trait Implementations§
Source§impl Clone for OnionClient
impl Clone for OnionClient
Source§fn clone(&self) -> OnionClient
fn clone(&self) -> OnionClient
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for OnionClient
impl !RefUnwindSafe for OnionClient
impl Send for OnionClient
impl Sync for OnionClient
impl Unpin for OnionClient
impl !UnwindSafe for OnionClient
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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