#[repr(transparent)]pub struct XorSocketAddr {
pub addr: MappedSocketAddr,
}Expand description
Helper struct for SocketAddr that are stored as an
Attribute after an XOR operation with the TransactionId
of a Message.
Fields§
§addr: MappedSocketAddrThe parent MappedSocketAddr
Implementations§
Source§impl XorSocketAddr
impl XorSocketAddr
Sourcepub fn new(addr: SocketAddr, transaction: TransactionId) -> Self
pub fn new(addr: SocketAddr, transaction: TransactionId) -> Self
Create a new XorSocketAddr.
Sourcepub fn length(&self) -> u16
pub fn length(&self) -> u16
The number of bytes of this XorSocketAddr.
Sourcepub fn to_raw<'a>(&self, atype: AttributeType) -> RawAttribute<'a>
pub fn to_raw<'a>(&self, atype: AttributeType) -> RawAttribute<'a>
Convert this XorSocketAddr into a RawAttribute
Sourcepub fn from_raw(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>
pub fn from_raw(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>
Try to convert a RawAttribute into a XorSocketAddr
Sourcepub fn xor_addr(addr: SocketAddr, transaction: TransactionId) -> SocketAddr
pub fn xor_addr(addr: SocketAddr, transaction: TransactionId) -> SocketAddr
Returns the XOR of the addr with the transaction and the hardcoded XOR constant.
Sourcepub fn addr(&self, transaction: TransactionId) -> SocketAddr
pub fn addr(&self, transaction: TransactionId) -> SocketAddr
Retrieve the SocketAddr from this XorSocketAddr
Sourcepub fn write_into_unchecked(&self, dest: &mut [u8])
pub fn write_into_unchecked(&self, dest: &mut [u8])
Write the XorSocketAddr to the provided destination buffer.
Trait Implementations§
Source§impl Clone for XorSocketAddr
impl Clone for XorSocketAddr
Source§fn clone(&self) -> XorSocketAddr
fn clone(&self) -> XorSocketAddr
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for XorSocketAddr
impl Debug for XorSocketAddr
Source§impl Display for XorSocketAddr
impl Display for XorSocketAddr
Source§impl PartialEq for XorSocketAddr
impl PartialEq for XorSocketAddr
impl Eq for XorSocketAddr
impl StructuralPartialEq for XorSocketAddr
Auto Trait Implementations§
impl Freeze for XorSocketAddr
impl RefUnwindSafe for XorSocketAddr
impl Send for XorSocketAddr
impl Sync for XorSocketAddr
impl Unpin for XorSocketAddr
impl UnwindSafe for XorSocketAddr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more