[−][src]Struct tox_packet::dht::DhtRequest
DHT Request packet struct. DHT Request packet consists of NatPingRequest and NatPingResponse. When my known friend is not connected directly, send NatPingRequest to peers which are in Ktree. When NatPingResponse arrives to me, it means that my known friend is also searching me, and running behind NAT, so start hole-punching.
https://zetok.github.io/tox-spec/#dht-request-packets
Length | Content |
---|---|
1 | 0x20 |
32 | Receiver's Public Key |
32 | Sender's Public Key |
24 | Nonce |
variable | Payload |
where Payload is encrypted DhtRequestPayload
Fields
rpk: PublicKey
receiver public key
spk: PublicKey
sender public key
nonce: Nonce
one time serial number
payload: Vec<u8>
payload of DhtRequest packet
Implementations
impl DhtRequest
[src]
pub fn new(
shared_secret: &PrecomputedKey,
rpk: &PublicKey,
spk: &PublicKey,
dp: &DhtRequestPayload
) -> DhtRequest
[src]
shared_secret: &PrecomputedKey,
rpk: &PublicKey,
spk: &PublicKey,
dp: &DhtRequestPayload
) -> DhtRequest
create new DhtRequest object
pub fn get_payload(
&self,
shared_secret: &PrecomputedKey
) -> Result<DhtRequestPayload, GetPayloadError>
[src]
&self,
shared_secret: &PrecomputedKey
) -> Result<DhtRequestPayload, GetPayloadError>
Decrypt payload and try to parse it as packet type.
Returns Error
in case of failure:
- fails to decrypt
- fails to parse as given packet type
Trait Implementations
impl Clone for DhtRequest
[src]
pub fn clone(&self) -> DhtRequest
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for DhtRequest
[src]
impl Eq for DhtRequest
[src]
impl FromBytes for DhtRequest
[src]
impl PartialEq<DhtRequest> for DhtRequest
[src]
pub fn eq(&self, other: &DhtRequest) -> bool
[src]
pub fn ne(&self, other: &DhtRequest) -> bool
[src]
impl StructuralEq for DhtRequest
[src]
impl StructuralPartialEq for DhtRequest
[src]
impl ToBytes for DhtRequest
[src]
Auto Trait Implementations
impl RefUnwindSafe for DhtRequest
[src]
impl Send for DhtRequest
[src]
impl Sync for DhtRequest
[src]
impl Unpin for DhtRequest
[src]
impl UnwindSafe for DhtRequest
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,