pub struct Server { /* private fields */ }
server
only.Expand description
A running Relay + STUN server.
This is a full Relay server, including STUN, Relay and various associated HTTP services.
Dropping this will stop the server.
Implementations§
Source§impl Server
impl Server
Sourcepub async fn spawn<EC, EA>(config: ServerConfig<EC, EA>) -> Result<Self>
pub async fn spawn<EC, EA>(config: ServerConfig<EC, EA>) -> Result<Self>
Starts the server.
Sourcepub async fn shutdown(self) -> Result<()>
pub async fn shutdown(self) -> Result<()>
Requests graceful shutdown.
Returns once all server tasks have stopped.
Sourcepub fn task_handle(&mut self) -> &mut AbortOnDropHandle<Result<()>>
pub fn task_handle(&mut self) -> &mut AbortOnDropHandle<Result<()>>
Returns the handle for the task.
This allows waiting for the server’s supervisor task to finish. Can be useful in case there is an error in the server before it is shut down.
Sourcepub fn https_addr(&self) -> Option<SocketAddr>
pub fn https_addr(&self) -> Option<SocketAddr>
The socket address the HTTPS server is listening on.
Sourcepub fn http_addr(&self) -> Option<SocketAddr>
pub fn http_addr(&self) -> Option<SocketAddr>
The socket address the HTTP server is listening on.
Sourcepub fn quic_addr(&self) -> Option<SocketAddr>
pub fn quic_addr(&self) -> Option<SocketAddr>
The socket address the QUIC server is listening on.
Sourcepub fn stun_addr(&self) -> Option<SocketAddr>
pub fn stun_addr(&self) -> Option<SocketAddr>
The socket address the STUN server is listening on.
Sourcepub fn certificates(&self) -> Option<Vec<CertificateDer<'static>>>
pub fn certificates(&self) -> Option<Vec<CertificateDer<'static>>>
The certificates chain if configured with manual TLS certificates.
Sourcepub fn https_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils
only.
pub fn https_url(&self) -> Option<RelayUrl>
test-utils
only.Get the server’s https RelayUrl
.
This uses Self::https_addr
so it’s mostly useful for local development.
Sourcepub fn http_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils
only.
pub fn http_url(&self) -> Option<RelayUrl>
test-utils
only.Get the server’s http RelayUrl
.
This uses Self::http_addr
so it’s mostly useful for local development.
Sourcepub fn metrics(&self) -> &RelayMetrics
pub fn metrics(&self) -> &RelayMetrics
Returns the metrics collected in the relay server.