Struct stun::xoraddr::XorMappedAddress

source ·
pub struct XorMappedAddress {
    pub ip: IpAddr,
    pub port: u16,
}
Expand description

XORMappedAddress implements XOR-MAPPED-ADDRESS attribute.

RFC 5389 Section 15.2

Fields§

§ip: IpAddr§port: u16

Implementations§

source§

impl XorMappedAddress

source

pub fn add_to_as(&self, m: &mut Message, t: AttrType) -> Result<(), Error>

add_to_as adds XOR-MAPPED-ADDRESS value to m as t attribute.

source

pub fn get_from_as(&mut self, m: &Message, t: AttrType) -> Result<(), Error>

get_from_as decodes XOR-MAPPED-ADDRESS attribute value in message getting it as for t type.

Trait Implementations§

source§

impl Default for XorMappedAddress

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for XorMappedAddress

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Getter for XorMappedAddress

source§

fn get_from(&mut self, m: &Message) -> Result<(), Error>

get_from decodes XOR-MAPPED-ADDRESS attribute in message and returns error if any. While decoding, a.IP is reused if possible and can be rendered to invalid state (e.g. if a.IP was set to IPv6 and then IPv4 value were decoded into it), be careful.

source§

impl Setter for XorMappedAddress

source§

fn add_to(&self, m: &mut Message) -> Result<(), Error>

add_to adds XOR-MAPPED-ADDRESS to m. Can return ErrBadIPLength if len(a.IP) is invalid.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V