Skip to main content

AllocateOptions

Struct AllocateOptions 

Source
pub struct AllocateOptions {
    pub transport: RelayTransport,
    pub address_family: Option<RequestedAddressFamily>,
    pub additional_ipv6: bool,
    pub lifetime: Option<Duration>,
    pub dont_fragment: bool,
    pub even_port: Option<EvenPort>,
    pub reservation_token: Option<ReservationToken>,
}
Expand description

What an Allocate request asks for beyond a UDP relayed address (RFC 8656 §7.1).

The default asks for nothing more: one relayed address, IPv4 unless the server decides otherwise, for the server’s default lifetime.

The RFC forbids some combinations, and Client::allocate_with refuses them before anything is sent: address_family with additional_ipv6 or reservation_token; additional_ipv6 with reservation_token or with an even_port that reserves the next port; reservation_token with even_port.

A TCP allocation (RelayTransport::Tcp, RFC 6062 §4.1) takes none of dont_fragment, even_port and reservation_token, and cannot be asked for over UDP.

Fields§

§transport: RelayTransport

REQUESTED-TRANSPORT: what the allocation relays, UDP datagrams by default.

§address_family: Option<RequestedAddressFamily>

REQUESTED-ADDRESS-FAMILY: the family of the one relayed address, for example REQUESTED_FAMILY_IPV6 for an IPv6 relayed address.

§additional_ipv6: bool

ADDITIONAL-ADDRESS-FAMILY: an IPv6 relayed address beside the IPv4 one. The server may give only one of the two; Relay::address_error then says why.

§lifetime: Option<Duration>

LIFETIME: how long the allocation should last without a refresh. A hint; the server answers with what it grants, which the client then goes by.

§dont_fragment: bool

DONT-FRAGMENT, to find out whether the server supports it and so whether Relay::send_to_dont_fragment can be used. A server that does not know the attribute answers 420; the client then makes the request again without it.

§even_port: Option<EvenPort>

EVEN-PORT: an even relayed port, and with reserve_port the next port held for a later allocation, which the response’s RESERVATION-TOKEN names.

§reservation_token: Option<ReservationToken>

RESERVATION-TOKEN: use the port a previous allocation reserved.

Trait Implementations§

Source§

impl Clone for AllocateOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AllocateOptions

Source§

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

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

impl Default for AllocateOptions

Source§

fn default() -> Self

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

impl Eq for AllocateOptions

Source§

impl PartialEq for AllocateOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AllocateOptions

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.