iroh_relay/defaults.rs
1//! Default values used in the relay.
2
3/// The default QUIC port used by the Relay server to accept QUIC connections
4/// for QUIC address discovery
5///
6/// The port is "QUIC" typed on a phone keypad.
7pub const DEFAULT_RELAY_QUIC_PORT: u16 = 7842;
8
9/// The default HTTP port used by the Relay server.
10pub const DEFAULT_HTTP_PORT: u16 = 80;
11
12/// The default HTTPS port used by the Relay server.
13pub const DEFAULT_HTTPS_PORT: u16 = 443;
14
15/// The default metrics port used by the Relay server.
16pub const DEFAULT_METRICS_PORT: u16 = 9090;
17
18/// The default capacity of the key cache for the relay server.
19///
20/// Sized for 1 million concurrent clients.
21/// memory usage will be (32 + 8 + 8 + 8) * 1_000_000 = 56MB on 64 bit,
22/// which seems reasonable for a server.
23pub const DEFAULT_KEY_CACHE_CAPACITY: usize = 1024 * 1024;
24
25/// Contains all timeouts that we use in `iroh`.
26#[cfg(not(wasm_browser))]
27pub(crate) mod timeouts {
28 use n0_future::time::Duration;
29
30 /// Timeout used by the relay client while connecting to the relay server,
31 /// using `TcpStream::connect`
32 pub(crate) const DIAL_ENDPOINT_TIMEOUT: Duration = Duration::from_millis(1500);
33 /// Timeout for our async dns resolver
34 pub(crate) const DNS_TIMEOUT: Duration = Duration::from_secs(1);
35
36 /// Maximum time the server will attempt to get a successful write to the connection.
37 #[cfg(feature = "server")]
38 pub(crate) const SERVER_WRITE_TIMEOUT: Duration = Duration::from_secs(2);
39}