[−][src]Struct tox_packet::onion::OnionReturn
Encrypted onion return addresses. Payload contains encrypted with symmetric
key IpPort
and possibly inner OnionReturn
.
When DHT node receives OnionRequest packet it appends OnionReturn
to the end
of the next request packet it will send. So when DHT node receives OnionResponse
packet it will know where to send the next response packet by decrypting
OnionReturn
from received packet. If node can't decrypt OnionReturn
that
means that onion path is expired and packet should be dropped.
Serialized form:
Length | Content |
---|---|
24 | Nonce |
35 or 94 or 153 | Payload |
where payload is encrypted inner OnionReturn
Fields
nonce: Nonce
Nonce for the current encrypted payload
payload: Vec<u8>
Encrypted payload
Implementations
impl OnionReturn
[src]
pub fn new(
symmetric_key: &Key,
ip_port: &IpPort,
inner: Option<&OnionReturn>
) -> OnionReturn
[src]
symmetric_key: &Key,
ip_port: &IpPort,
inner: Option<&OnionReturn>
) -> OnionReturn
Create new OnionReturn
object using symmetric key for encryption.
pub fn get_payload(
&self,
symmetric_key: &Key
) -> Result<(IpPort, Option<OnionReturn>), Error>
[src]
&self,
symmetric_key: &Key
) -> Result<(IpPort, Option<OnionReturn>), Error>
Decrypt payload with symmetric key and try to parse it as IpPort
with possibly inner OnionReturn
.
Returns Error
in case of failure:
- fails to decrypt
- fails to parse as
IpPort
with possibly innerOnionReturn
Trait Implementations
impl Clone for OnionReturn
[src]
pub fn clone(&self) -> OnionReturn
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for OnionReturn
[src]
impl Eq for OnionReturn
[src]
impl FromBytes for OnionReturn
[src]
impl PartialEq<OnionReturn> for OnionReturn
[src]
pub fn eq(&self, other: &OnionReturn) -> bool
[src]
pub fn ne(&self, other: &OnionReturn) -> bool
[src]
impl StructuralEq for OnionReturn
[src]
impl StructuralPartialEq for OnionReturn
[src]
impl ToBytes for OnionReturn
[src]
Auto Trait Implementations
impl RefUnwindSafe for OnionReturn
[src]
impl Send for OnionReturn
[src]
impl Sync for OnionReturn
[src]
impl Unpin for OnionReturn
[src]
impl UnwindSafe for OnionReturn
[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>,