use std::{fmt, num::NonZeroU32, time::Duration};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum RammuxRole {
Client,
Server,
}
impl fmt::Display for RammuxRole {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Client => f.write_str("client"),
Self::Server => f.write_str("server"),
}
}
}
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct RammuxConfig {
pub frame_limit: NonZeroU32,
pub max_inbound_streams: u32,
pub max_outbound_streams: u32,
pub local_recv_window: NonZeroU32,
pub remote_recv_window: u32,
pub ping_interval: Duration,
pub global_recv_window: usize,
}
impl RammuxConfig {
pub const fn new() -> Self {
Self {
frame_limit: NonZeroU32::new(16 * 1024).unwrap(),
max_inbound_streams: 128,
max_outbound_streams: 128,
local_recv_window: NonZeroU32::new(64 * 1024).unwrap(),
remote_recv_window: 64 * 1024,
ping_interval: Duration::from_secs(5),
global_recv_window: 4 * 1024 * 1024,
}
}
}
impl Default for RammuxConfig {
fn default() -> Self {
Self::new()
}
}