pub struct WebTransportServerConfig {
pub cert: CertificateDer<'static>,
pub key: PrivateKeyDer<'static>,
pub listen: SocketAddr,
pub max_clients: usize,
}Expand description
Configuration for setting up a WebTransportServer.
Fields§
§cert: CertificateDer<'static>The certificate for this server.
Note that if the certificate expires, then the server will no longer make connections.
This is relevant for clients that use ServerCertHash, which can only connect to certificates with an
expiration under
two weeks.
key: PrivateKeyDer<'static>The private key for this server.
listen: SocketAddrSocket address to listen on.
It is recommended to use a pre-defined IP and a wildcard port.
The pre-defined IP should be used when obtaining Self::cert from your certificate authority (CA).
Using a wildcard port will reduce your chance of competing with other sockets on your machine (e.g. other WebTransport servers running different game instances).
max_clients: usizeMaximum number of active clients allowed.
Implementations§
Source§impl WebTransportServerConfig
impl WebTransportServerConfig
Sourcepub fn new_selfsigned(
listen: SocketAddr,
max_clients: usize,
) -> (Self, ServerCertHash)
pub fn new_selfsigned( listen: SocketAddr, max_clients: usize, ) -> (Self, ServerCertHash)
Makes a new config with a self-signed CertificateDer tied to the listen address.
Returns the ServerCertHash of the certificate, which can be used to set up clients via
WebTransportClientConfig.
The certificate produced will be valid for two weeks (minus one hour and one minute).
Use Self::new_selfsigned_with_proxies if you want the certificate to bind to a URL (e.g. domain name).
Sourcepub fn new_selfsigned_with_proxies(
listen: SocketAddr,
proxies: Vec<WebServerDestination>,
max_clients: usize,
) -> (Self, ServerCertHash)
pub fn new_selfsigned_with_proxies( listen: SocketAddr, proxies: Vec<WebServerDestination>, max_clients: usize, ) -> (Self, ServerCertHash)
Makes a new config with a self-signed CertificateDer tied to the proxies destinations.
Returns the ServerCertHash of the certificate, which can be used to set up clients via
WebTransportClientConfig.
The certificate produced will be valid for two weeks (minus one hour and one minute).
Use Self::new_selfsigned_with_proxies if you only want the certificate to bind to the listen address.
Sourcepub fn create_server_config(self) -> Result<ServerConfig, Error>
pub fn create_server_config(self) -> Result<ServerConfig, Error>
Converts self into a wtransport::ServerConfig.
Used automatically by WebTransportServer::new.
Trait Implementations§
Source§impl Clone for WebTransportServerConfig
impl Clone for WebTransportServerConfig
Auto Trait Implementations§
impl Freeze for WebTransportServerConfig
impl RefUnwindSafe for WebTransportServerConfig
impl Send for WebTransportServerConfig
impl Sync for WebTransportServerConfig
impl Unpin for WebTransportServerConfig
impl UnwindSafe for WebTransportServerConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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.