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.