39 lines
1.2 KiB
Rust

pub mod mocks;
pub mod stun_builders;
pub mod tls;
use std::net::SocketAddr;
use niom_turn::auth::{AuthManager, InMemoryStore};
use niom_turn::config::AuthOptions;
/// Ensure tracing is initialised for integration tests with the library defaults.
#[allow(dead_code)]
pub fn init_tracing() {
niom_turn::logging::init_tracing();
}
/// Initialise tracing with a custom default directive (still overridable via `RUST_LOG`).
#[allow(dead_code)]
pub fn init_tracing_with(default_directive: &str) {
niom_turn::logging::init_tracing_with_default(default_directive);
}
/// Helper to construct a basic AuthManager with a single credential for integration tests.
pub fn test_auth_manager(user: &str, password: &str) -> AuthManager<InMemoryStore> {
let store = InMemoryStore::new();
store.insert(user, password);
AuthManager::new(store, &AuthOptions::default())
}
/// Default TURN client credential used in integration scenarios.
pub fn default_test_credentials() -> (&'static str, &'static str) {
("testuser", "secretpassword")
}
/// Convenience to parse socket addresses in tests.
#[allow(dead_code)]
pub fn addr(addr: &str) -> SocketAddr {
addr.parse().expect("valid socket addr")
}