http_tunnel_common/
constants.rs1pub const MAX_CONNECTION_LIFETIME_SECS: i64 = 7200;
3
4pub const CONNECTION_TTL_SECS: i64 = 7200;
6
7pub const HEARTBEAT_INTERVAL_SECS: u64 = 300;
9
10pub const WEBSOCKET_IDLE_TIMEOUT_SECS: u64 = 600;
12
13pub const REQUEST_TIMEOUT_SECS: u64 = 25;
15
16pub const PENDING_REQUEST_TTL_SECS: i64 = 30;
18
19pub const MAX_BODY_SIZE_BYTES: usize = 2 * 1024 * 1024;
21
22pub const RECONNECT_MIN_DELAY_MS: u64 = 1000;
24
25pub const RECONNECT_MAX_DELAY_MS: u64 = 60000;
27
28pub const RECONNECT_MULTIPLIER: f64 = 2.0;
30
31pub const POLL_INITIAL_INTERVAL_MS: u64 = 50;
33
34pub const POLL_MAX_INTERVAL_MS: u64 = 500;
36
37pub const POLL_BACKOFF_MULTIPLIER: u32 = 2;
39
40pub const OPTIMIZED_POLL_FIRST_INTERVAL_MS: u64 = 200;
42
43pub const OPTIMIZED_POLL_SECOND_INTERVAL_MS: u64 = 300;
45
46pub const OPTIMIZED_POLL_FINAL_INTERVAL_MS: u64 = 400;
48
49#[cfg(test)]
50mod tests {
51 use super::*;
52
53 #[test]
54 fn test_constants_values() {
55 const _: () = assert!(REQUEST_TIMEOUT_SECS < 29, "Must be under API Gateway limit");
58 const _: () = assert!(HEARTBEAT_INTERVAL_SECS < WEBSOCKET_IDLE_TIMEOUT_SECS);
59 const _: () = assert!(PENDING_REQUEST_TTL_SECS < MAX_CONNECTION_LIFETIME_SECS);
60 const _: () = assert!(RECONNECT_MIN_DELAY_MS < RECONNECT_MAX_DELAY_MS);
61 const _: () = assert!(RECONNECT_MULTIPLIER > 1.0);
62
63 assert_eq!(MAX_BODY_SIZE_BYTES, 2 * 1024 * 1024);
65 }
66}