hyperlane/config/
struct.rs

1use crate::*;
2
3/// Represents the inner, mutable server configuration.
4///
5/// This structure holds all the settings for the HTTP and WebSocket server,
6/// including network parameters and buffer sizes. It is not intended to be used directly
7/// by end-users, but rather through the `ServerConfig` wrapper.
8#[derive(Clone, Data, CustomDebug, DisplayDebug, PartialEq, Eq, Deserialize, Serialize)]
9pub(crate) struct ServerConfigInner {
10    /// The host address the server will bind to.
11    #[get(pub(crate))]
12    #[get_mut(pub(super))]
13    #[set(pub(super))]
14    pub(super) host: String,
15    /// The port number the server will listen on.
16    #[get(pub(crate))]
17    #[get_mut(pub(super))]
18    #[set(pub(super))]
19    pub(super) port: usize,
20    /// The buffer size for HTTP connections.
21    #[get(pub(crate))]
22    #[get_mut(pub(super))]
23    #[set(pub(super))]
24    pub(super) buffer: usize,
25    /// The `TCP_NODELAY` option for sockets.
26    #[get(pub(crate))]
27    #[get_mut(pub(super))]
28    #[set(pub(super))]
29    pub(super) nodelay: OptionBool,
30    /// The `SO_LINGER` option for sockets.
31    #[get(pub(crate))]
32    #[get_mut(pub(super))]
33    #[set(pub(super))]
34    pub(super) linger: OptionDuration,
35    /// The `IP_TTL` option for sockets.
36    #[get(pub(crate))]
37    #[get_mut(pub(super))]
38    #[set(pub(super))]
39    pub(super) ttl: OptionU32,
40}
41
42/// Represents the thread-safe, shareable server configuration.
43///
44/// This structure wraps `ServerConfigInner` in an `Arc<RwLock<ServerConfigInner>>`
45/// to allow for safe concurrent access and modification of the server settings.
46#[derive(Clone, Getter, CustomDebug, DisplayDebug)]
47pub struct ServerConfig(#[get(pub(super))] pub(super) SharedServerConfig);