Struct ConnectTokenBuilder

Source
pub struct ConnectTokenBuilder<A: ToSocketAddrs> { /* private fields */ }
Expand description

A builder that can be used to generate a connect token.

Implementations§

Source§

impl<A: ToSocketAddrs> ConnectTokenBuilder<A>

Source

pub fn expire_seconds(self, expire_seconds: i32) -> Self

Sets the time in seconds that the token will be valid for.

Negative values will disable expiry.

Source

pub fn timeout_seconds(self, timeout_seconds: i32) -> Self

Sets the time in seconds that a connection will be kept alive without any packets being received.

Negative values will disable timeouts.

Source

pub fn user_data(self, user_data: [u8; 256]) -> Self

Sets the user data that will be added to the token, this can be any data you want.

Source

pub fn internal_addresses(self, internal_addresses: A) -> Result<Self, Error>

Sets the internal server addresses in the private data of the token.
If this field is not set, the public server addresses provided when creating the builder will be used instead.

The internal server addresses list is used by the server to determine if the client is connecting to the same server that issued the token. The client will always use the public server addresses list to connect to the server, never the internal ones.

This is useful for when you bind your server to a local address that is not accessible from the internet, but you want to provide a public address that is accessible to the client.

Source

pub fn generate(self) -> Result<ConnectToken, Error>

Generates the token and consumes the builder.

Auto Trait Implementations§

§

impl<A> Freeze for ConnectTokenBuilder<A>
where A: Freeze,

§

impl<A> RefUnwindSafe for ConnectTokenBuilder<A>
where A: RefUnwindSafe,

§

impl<A> Send for ConnectTokenBuilder<A>
where A: Send,

§

impl<A> Sync for ConnectTokenBuilder<A>
where A: Sync,

§

impl<A> Unpin for ConnectTokenBuilder<A>
where A: Unpin,

§

impl<A> UnwindSafe for ConnectTokenBuilder<A>
where A: UnwindSafe,

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

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.