[][src]Struct tox_core::onion::onion_announce::OnionAnnounce

pub struct OnionAnnounce { /* fields omitted */ }

Holds list of announced onion nodes and process announce requests.

Implementations

impl OnionAnnounce[src]

pub fn new(dht_pk: PublicKey) -> OnionAnnounce[src]

Create new OnionAnnounce instance.

pub fn handle_onion_announce_request(
    &mut self,
    payload: &OnionAnnounceRequestPayload,
    request_pk: PublicKey,
    onion_return: OnionReturn,
    addr: SocketAddr
) -> (AnnounceStatus, Digest)
[src]

Handle payload OnionAnnounceRequest packet and return AnnounceStatus with ping id or PublicKey.

If OnionAnnounceRequest packet contains valid onion ping id it's considered as announce request. Otherwise it's considered as search request. In case of announce request we try to add new entry to announce list and if succeed return status AnnounceStatus::Announced. In case of search request we try to find entry by search_pk key from request and if succeed return status AnnounceStatus::Found. If announce or search failed we return status AnnounceStatus::Failed.

If request is a search request and we found requested node then the result will contain PublicKey that should be used to send data packets to requested node. Otherwise it will contain valid onion ping id that should be used to send announce requests to this node.

pub fn handle_data_request(
    &self,
    request: OnionDataRequest
) -> Result<(OnionResponse3, SocketAddr), Error>
[src]

Handle data request and build OnionResponse3 packet that should be sent to determined address.

When onion node handles OnionDataRequest it checks if onion entry list contains destination node and when entry exists sends OnionDataResponse to this node through its onion path.

Trait Implementations

impl Clone for OnionAnnounce[src]

impl Debug for OnionAnnounce[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.