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