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

XORMappedAddress implements XOR-MAPPED-ADDRESS attribute.

RFC 5389 Section 15.2

Fields

ip: IpAddrport: u16

Implementations

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

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

Trait Implementations

Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more

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.

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.