1use std::net::SocketAddr;
2
3use anyhow::Context;
4
5pub const DEFAULT_MAX_DECODING_MESSAGE_SIZE: usize = 4 * 1024 * 1024;
7
8pub trait UrlExt: private::Sealed {
11 fn to_socket(&self) -> anyhow::Result<SocketAddr>;
12}
13
14impl UrlExt for url::Url {
15 fn to_socket(&self) -> anyhow::Result<SocketAddr> {
16 self.socket_addrs(|| None)?
17 .into_iter()
18 .next()
19 .with_context(|| format!("failed to convert url {self} to socket address"))
20 }
21}
22
23mod private {
24 pub trait Sealed {}
25 impl Sealed for url::Url {}
26}
27
28mod layers;
29pub use layers::*;
30
31mod server;
32pub use server::{server_builder, tcp_incoming};