pub mod additions;
#[cfg_attr(docsrs, doc(cfg(feature = "clients")))]
#[cfg(feature = "clients")]
pub mod client;
pub mod errors;
mod ext_map;
pub mod handlers;
pub mod models;
#[cfg_attr(docsrs, doc(cfg(feature = "servers")))]
#[cfg(feature = "servers")]
pub mod server;
pub use ext_map::Extensions;
#[cfg(test)]
use std::sync::RwLock;
use std::{
sync::atomic::AtomicU64,
time::{Duration, SystemTime},
};
#[cfg(debug_assertions)]
use std::{env::var as env_var, sync::LazyLock};
pub const DEFAULT_CAT_DEV_SLOWDOWN: Duration = Duration::from_millis(25);
pub const DEFAULT_CAT_DEV_CHUNK_SIZE: usize = 65536;
const DEFAULT_SLOWLORIS_TIMEOUT: Duration = Duration::from_secs(10 * 60);
static STREAM_ID: AtomicU64 = AtomicU64::new(1);
#[cfg(feature = "servers")]
static SERVER_ID: AtomicU64 = AtomicU64::new(1);
static TCP_READ_BUFFER_SIZE: usize = 65536_usize;
#[cfg(debug_assertions)]
static SPRIG_TRACE_IO: LazyLock<bool> = LazyLock::new(|| {
if let Ok(variable) = env_var("SPRIG_FORCE_TRACE_ALL_IO") {
variable != "0" && !variable.is_empty()
} else {
false
}
});
thread_local! {
#[cfg(test)]
static CURRENT_TIME: LazyLock<RwLock<SystemTime>> = LazyLock::new(|| RwLock::new(SystemTime::now()));
}
#[cfg(not(test))]
fn now() -> SystemTime {
SystemTime::now()
}
#[cfg(test)]
fn now() -> SystemTime {
CURRENT_TIME.with(|time_lazy| time_lazy.read().expect("RwLock is poisioned?").clone())
}
#[cfg(test)]
pub mod test_helpers {
#[cfg(feature = "servers")]
pub use crate::net::server::test_helpers::*;
}