1use std::time::Duration;
4
5#[derive(Debug, Clone)]
7pub struct ServerConfig {
8 pub enable_sotw: bool,
10 pub enable_delta: bool,
12 pub max_concurrent_streams: Option<u32>,
14 pub keepalive_interval: Option<Duration>,
16 pub keepalive_timeout: Option<Duration>,
18 pub max_request_size: usize,
20 pub compression: CompressionConfig,
22 pub grace_period: Duration,
24 pub enable_health: bool,
26 pub enable_metrics: bool,
28 pub enable_connection_tracking: bool,
30}
31
32impl Default for ServerConfig {
33 fn default() -> Self {
34 Self {
35 enable_sotw: true,
36 enable_delta: false,
37 max_concurrent_streams: Some(100),
38 keepalive_interval: Some(Duration::from_secs(30)),
39 keepalive_timeout: Some(Duration::from_secs(10)),
40 max_request_size: 4 * 1024 * 1024, compression: CompressionConfig::default(),
42 grace_period: Duration::from_secs(30),
43 enable_health: true,
44 enable_metrics: true,
45 enable_connection_tracking: true,
46 }
47 }
48}
49
50#[derive(Debug, Clone, Default)]
52pub struct CompressionConfig {
53 pub gzip: bool,
55 pub min_size: usize,
57}
58
59impl CompressionConfig {
60 pub fn gzip() -> Self {
62 Self {
63 gzip: true,
64 min_size: 1024,
65 }
66 }
67}