[−][src]Struct tox_packet::dht::NodesResponse
Nodes response packet struct. When DHT node receives NodesRequest
it
should respond with NodesResponse
that contains up to to 4 closest nodes to
requested public key. Ping id should be the same as it was in NodesRequest
.
https://zetok.github.io/tox-spec/#dht-packet
Length | Content |
---|---|
1 | 0x04 |
32 | Public Key |
24 | Nonce |
1 | Number of Response Nodes |
[25,229] | Payload |
where Payload is encrypted NodesResponsePayload
Fields
pk: PublicKey
public key used for payload encryption
nonce: Nonce
one time serial number
payload: Vec<u8>
encrypted payload
Implementations
impl NodesResponse
[src]
pub fn new(
shared_secret: &PrecomputedKey,
pk: &PublicKey,
payload: &NodesResponsePayload
) -> NodesResponse
[src]
shared_secret: &PrecomputedKey,
pk: &PublicKey,
payload: &NodesResponsePayload
) -> NodesResponse
create new NodesResponse object
pub fn get_payload(
&self,
shared_secret: &PrecomputedKey
) -> Result<NodesResponsePayload, GetPayloadError>
[src]
&self,
shared_secret: &PrecomputedKey
) -> Result<NodesResponsePayload, GetPayloadError>
Decrypt payload and try to parse it as NodesResponsePayload
.
Returns Error
in case of failure:
- fails to decrypt
- fails to parse as given packet type
Trait Implementations
impl Clone for NodesResponse
[src]
pub fn clone(&self) -> NodesResponse
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for NodesResponse
[src]
impl Eq for NodesResponse
[src]
impl FromBytes for NodesResponse
[src]
impl PartialEq<NodesResponse> for NodesResponse
[src]
pub fn eq(&self, other: &NodesResponse) -> bool
[src]
pub fn ne(&self, other: &NodesResponse) -> bool
[src]
impl StructuralEq for NodesResponse
[src]
impl StructuralPartialEq for NodesResponse
[src]
impl ToBytes for NodesResponse
[src]
Auto Trait Implementations
impl RefUnwindSafe for NodesResponse
[src]
impl Send for NodesResponse
[src]
impl Sync for NodesResponse
[src]
impl Unpin for NodesResponse
[src]
impl UnwindSafe for NodesResponse
[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>,