[][src]Struct tox_packet::onion::InnerOnionAnnounceRequest

pub struct InnerOnionAnnounceRequest {
    pub nonce: Nonce,
    pub pk: PublicKey,
    pub payload: Vec<u8>,
}

It's used for announcing ourselves to onion node and for looking for other announced nodes.

If we want to announce ourselves we should send one OnionAnnounceRequest packet with PingId set to 0 to acquire correct PingId of onion node. Then using this PingId we can send another OnionAnnounceRequest to be added to onion nodes list. If OnionAnnounceRequest succeed we will get OnionAnnounceResponse with announce_status set to 2. Otherwise announce_status will be set to 0.

If we are looking for another node we should send OnionAnnounceRequest packet with PingId set to 0 and with PublicKey of this node. If node is found we will get OnionAnnounceResponse with announce_status set to 1. Otherwise announce_status will be set to 0.

Serialized form:

LengthContent
10x83
24Nonce
32Temporary or real PublicKey
variablePayload

where payload is encrypted OnionAnnounceRequestPayload

Fields

nonce: Nonce

Nonce for the current encrypted payload

pk: PublicKey

Temporary or real PublicKey for the current encrypted payload

payload: Vec<u8>

Encrypted payload

Implementations

impl InnerOnionAnnounceRequest[src]

pub fn new(
    shared_secret: &PrecomputedKey,
    pk: &PublicKey,
    payload: &OnionAnnounceRequestPayload
) -> InnerOnionAnnounceRequest
[src]

Create new InnerOnionAnnounceRequest object.

pub fn get_payload(
    &self,
    shared_secret: &PrecomputedKey
) -> Result<OnionAnnounceRequestPayload, GetPayloadError>
[src]

Decrypt payload and try to parse it as OnionAnnounceRequestPayload.

Returns Error in case of failure:

  • fails to decrypt
  • fails to parse as OnionAnnounceRequestPayload

Trait Implementations

impl Clone for InnerOnionAnnounceRequest[src]

impl Debug for InnerOnionAnnounceRequest[src]

impl Eq for InnerOnionAnnounceRequest[src]

impl FromBytes for InnerOnionAnnounceRequest[src]

impl PartialEq<InnerOnionAnnounceRequest> for InnerOnionAnnounceRequest[src]

impl StructuralEq for InnerOnionAnnounceRequest[src]

impl StructuralPartialEq for InnerOnionAnnounceRequest[src]

impl ToBytes for InnerOnionAnnounceRequest[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.