pub struct Config {
pub host: String,
pub listen: Option<String>,
pub port: u16,
pub max_memory_mb: Option<u64>,
pub read_buffer_kb: Option<usize>,
pub username: Option<String>,
pub password: Option<String>,
pub max_failed_attempts: u32,
pub lockout_duration_seconds: u64,
}Fields§
§host: String§listen: Option<String>Alias for host. If set, overrides host.
port: u16§max_memory_mb: Option<u64>Maximum memory for values (in megabytes). If None, auto-detect from system.
read_buffer_kb: Option<usize>Socket read buffer size (in kilobytes).
username: Option<String>Username for authentication (optional)
password: Option<String>Password for authentication (optional)
max_failed_attempts: u32Maximum failed login attempts before lockout (default: 3)
lockout_duration_seconds: u64Lockout duration in seconds after max failed attempts (default: 600 = 10 minutes)
Implementations§
Source§impl Config
impl Config
pub fn load() -> Result<Self>
pub fn addr(&self) -> SocketAddr
pub fn requires_auth(&self) -> bool
pub fn check_auth(&self, username: Option<&str>, password: Option<&str>) -> bool
pub fn max_memory_bytes(&self) -> Option<u64>
pub fn read_buffer_size(&self) -> usize
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more