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>
impl<A: ToSocketAddrs> ConnectTokenBuilder<A>
Sourcepub fn expire_seconds(self, expire_seconds: i32) -> Self
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.
Sourcepub fn timeout_seconds(self, timeout_seconds: i32) -> Self
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.
Sourcepub fn user_data(self, user_data: [u8; 256]) -> Self
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.
Sourcepub fn internal_addresses(self, internal_addresses: A) -> Result<Self, Error>
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.
Sourcepub fn generate(self) -> Result<ConnectToken, Error>
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> 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.