[−][src]Struct tox_packet::dht::NodesRequest
Nodes request packet struct. It's used to get up to 4 closest nodes to
requested public key. Every 20 seconds DHT node sends NodesRequest
packet to
a random node in ktree and its known friends list.
https://zetok.github.io/tox-spec/#dht-packet
Length | Content |
---|---|
1 | 0x02 |
32 | Public Key |
24 | Nonce |
56 | Payload |
where Payload is encrypted NodesRequestPayload
Fields
pk: PublicKey
public key used for payload encryption
nonce: Nonce
one time serial number
payload: Vec<u8>
encrypted payload
Implementations
impl NodesRequest
[src]
pub fn new(
shared_secret: &PrecomputedKey,
pk: &PublicKey,
payload: &NodesRequestPayload
) -> NodesRequest
[src]
shared_secret: &PrecomputedKey,
pk: &PublicKey,
payload: &NodesRequestPayload
) -> NodesRequest
create new NodesRequest object
pub fn get_payload(
&self,
shared_secret: &PrecomputedKey
) -> Result<NodesRequestPayload, GetPayloadError>
[src]
&self,
shared_secret: &PrecomputedKey
) -> Result<NodesRequestPayload, GetPayloadError>
Decrypt payload and try to parse it as NodesRequestPayload
.
Returns Error
in case of failure:
- fails to decrypt
- fails to parse as given packet type
Trait Implementations
impl Clone for NodesRequest
[src]
fn clone(&self) -> NodesRequest
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for NodesRequest
[src]
impl Eq for NodesRequest
[src]
impl FromBytes for NodesRequest
[src]
impl PartialEq<NodesRequest> for NodesRequest
[src]
fn eq(&self, other: &NodesRequest) -> bool
[src]
fn ne(&self, other: &NodesRequest) -> bool
[src]
impl StructuralEq for NodesRequest
[src]
impl StructuralPartialEq for NodesRequest
[src]
impl ToBytes for NodesRequest
[src]
Auto Trait Implementations
impl RefUnwindSafe for NodesRequest
impl Send for NodesRequest
impl Sync for NodesRequest
impl Unpin for NodesRequest
impl UnwindSafe for NodesRequest
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,
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.
fn to_owned(&self) -> T
[src]
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.
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>,