[][src]Struct tox_core::onion::client::OnionClient

pub struct OnionClient { /* fields omitted */ }

Onion client that is responsible for announcing our DHT PublicKey to our friends and looking for their DHT PublicKeys.

Implementations

impl OnionClient[src]

pub fn new(
    dht: DhtServer,
    tcp_connections: TcpConnections,
    real_sk: SecretKey,
    real_pk: PublicKey
) -> Self
[src]

Create new OnionClient.

pub async fn set_dht_pk_sink(
    &self,
    dht_pk_tx: UnboundedSender<(PublicKey, PublicKey)>
)
[src]

Set sink to send DHT PublicKey when it gets known.

pub async fn set_friend_request_sink(
    &self,
    friend_request_sink: UnboundedSender<(PublicKey, FriendRequest)>
)
[src]

Set sink to receive FriendRequests.

pub async fn handle_announce_response(
    &self,
    packet: &OnionAnnounceResponse,
    is_global: bool
) -> Result<(), HandleAnnounceResponseError>
[src]

Handle OnionAnnounceResponse packet.

pub async fn handle_dht_pk_announce(
    &self,
    friend_pk: PublicKey,
    dht_pk_announce: DhtPkAnnouncePayload
) -> Result<(), HandleDhtPkAnnounceError>
[src]

Handle DHT PublicKey announce from both onion and DHT.

pub async fn handle_data_response(
    &self,
    packet: &OnionDataResponse
) -> Result<(), HandleDataResponseError>
[src]

Handle OnionDataResponse packet.

pub async fn add_path_node(&self, node: PackedNode)[src]

Add new node to random nodes pool to use them to build random paths.

pub async fn add_friend(&self, real_pk: PublicKey)[src]

Add a friend to start looking for its DHT PublicKey.

pub async fn remove_friend(&self, real_pk: PublicKey)[src]

Remove a friend and stop looking for him.

pub async fn set_friend_connected(&self, real_pk: PublicKey, connected: bool)[src]

Set connection status of a friend. If he's connected we can stop looking for his DHT PublicKey.

pub async fn set_friend_dht_pk(&self, real_pk: PublicKey, dht_pk: PublicKey)[src]

Set friend's DHT PublicKey when it gets known somewhere else.

pub async fn run(&self) -> Result<(), RunError>[src]

Run periodical announcements and friends searching.

Trait Implementations

impl Clone for OnionClient[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.