pub struct XorPeerAddress { /* private fields */ }Expand description
The XorPeerAddress Attribute.
Typically used for signalling the address of the peer that a TURN server should send data towards, or has received data from.
Reference: RFC5766 Section 14.3.
Implementations§
Source§impl XorPeerAddress
impl XorPeerAddress
Sourcepub fn new(addr: SocketAddr, transaction: TransactionId) -> Self
pub fn new(addr: SocketAddr, transaction: TransactionId) -> Self
Create a new XorPeerAddress Attribute.
§Examples
let addr = "127.0.0.1:1234".parse().unwrap();
let mapped_addr = XorPeerAddress::new(addr, 0x5678.into());
assert_eq!(mapped_addr.addr(0x5678.into()), addr);Sourcepub fn addr(&self, transaction: TransactionId) -> SocketAddr
pub fn addr(&self, transaction: TransactionId) -> SocketAddr
Retrieve the address stored in a XorPeerAddress.
§Examples
let addr = "[::1]:1234".parse().unwrap();
let mapped_addr = XorPeerAddress::new(addr, 0x5678.into());
assert_eq!(mapped_addr.addr(0x5678.into()), addr);Trait Implementations§
Source§impl Attribute for XorPeerAddress
impl Attribute for XorPeerAddress
Source§impl AttributeFromRaw<'_> for XorPeerAddress
impl AttributeFromRaw<'_> for XorPeerAddress
Source§fn from_raw_ref(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>where
Self: Sized,
fn from_raw_ref(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>where
Self: Sized,
Produce an
Attribute from a RawAttributeSource§fn from_raw(raw: RawAttribute<'a>) -> Result<Self, StunParseError>where
Self: Sized,
fn from_raw(raw: RawAttribute<'a>) -> Result<Self, StunParseError>where
Self: Sized,
Produce an
Attribute from a RawAttributeSource§impl AttributeStaticType for XorPeerAddress
impl AttributeStaticType for XorPeerAddress
Source§const TYPE: AttributeType
const TYPE: AttributeType
The
AttributeTypeSource§impl AttributeWrite for XorPeerAddress
impl AttributeWrite for XorPeerAddress
Source§fn to_raw(&self) -> RawAttribute<'_>
fn to_raw(&self) -> RawAttribute<'_>
Produce a
RawAttribute from this AttributeSource§fn write_into_unchecked(&self, dest: &mut [u8])
fn write_into_unchecked(&self, dest: &mut [u8])
Write attribute to the provided destination buffer. Read more
Source§impl Clone for XorPeerAddress
impl Clone for XorPeerAddress
Source§fn clone(&self) -> XorPeerAddress
fn clone(&self) -> XorPeerAddress
Returns a duplicate 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 XorPeerAddress
impl Debug for XorPeerAddress
Source§impl Display for XorPeerAddress
impl Display for XorPeerAddress
Source§impl TryFrom<&RawAttribute<'_>> for XorPeerAddress
impl TryFrom<&RawAttribute<'_>> for XorPeerAddress
Source§type Error = StunParseError
type Error = StunParseError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for XorPeerAddress
impl RefUnwindSafe for XorPeerAddress
impl Send for XorPeerAddress
impl Sync for XorPeerAddress
impl Unpin for XorPeerAddress
impl UnwindSafe for XorPeerAddress
Blanket Implementations§
Source§impl<A> AttributeExt for A
impl<A> AttributeExt for A
Source§impl<A> AttributeWriteExt for Awhere
A: AttributeWrite + ?Sized,
impl<A> AttributeWriteExt for Awhere
A: AttributeWrite + ?Sized,
Source§fn write_header(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
fn write_header(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
Write the 4 byte attribute header into the provided destination buffer returning the
number of bytes written, or an error.
Source§fn write_header_unchecked(&self, dest: &mut [u8]) -> usize
fn write_header_unchecked(&self, dest: &mut [u8]) -> usize
Write the 4 byte attribute header into the provided destination buffer returning the
number of bytes written. Read more
Source§fn write_into(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
fn write_into(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
Write this attribute into the provided destination buffer returning the number of bytes
written, or an error.
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