pub struct ValidationLimits {
pub cache_size: usize,
pub max_relays_per_group: usize,
pub max_messages_per_group: usize,
pub max_group_name_length: usize,
pub max_group_description_length: usize,
pub max_admins_per_group: usize,
pub max_relays_per_welcome: usize,
pub max_admins_per_welcome: usize,
pub max_relay_url_length: usize,
}Expand description
Configurable validation limits for memory storage.
This struct allows customization of the various limits used to prevent memory exhaustion attacks. All limits have sensible defaults that can be overridden using the builder pattern.
§Example
use mdk_memory_storage::ValidationLimits;
let limits = ValidationLimits::default()
.with_cache_size(2000)
.with_max_messages_per_group(5000)
.with_max_relays_per_group(50);Fields§
§cache_size: usizeMaximum number of items in each LRU cache
max_relays_per_group: usizeMaximum number of relays allowed per group
max_messages_per_group: usizeMaximum number of messages stored per group
max_group_name_length: usizeMaximum length of a group name in bytes
max_group_description_length: usizeMaximum length of a group description in bytes
max_admins_per_group: usizeMaximum number of admin pubkeys per group
max_relays_per_welcome: usizeMaximum number of relays in a welcome message
max_admins_per_welcome: usizeMaximum number of admin pubkeys in a welcome message
max_relay_url_length: usizeMaximum length of a relay URL in bytes
Implementations§
Source§impl ValidationLimits
impl ValidationLimits
Sourcepub fn with_cache_size(self, size: usize) -> Self
pub fn with_cache_size(self, size: usize) -> Self
Sourcepub fn with_max_relays_per_group(self, limit: usize) -> Self
pub fn with_max_relays_per_group(self, limit: usize) -> Self
Sourcepub fn with_max_messages_per_group(self, limit: usize) -> Self
pub fn with_max_messages_per_group(self, limit: usize) -> Self
Sourcepub fn with_max_group_name_length(self, limit: usize) -> Self
pub fn with_max_group_name_length(self, limit: usize) -> Self
Sourcepub fn with_max_group_description_length(self, limit: usize) -> Self
pub fn with_max_group_description_length(self, limit: usize) -> Self
Sourcepub fn with_max_admins_per_group(self, limit: usize) -> Self
pub fn with_max_admins_per_group(self, limit: usize) -> Self
Sourcepub fn with_max_relays_per_welcome(self, limit: usize) -> Self
pub fn with_max_relays_per_welcome(self, limit: usize) -> Self
Sourcepub fn with_max_admins_per_welcome(self, limit: usize) -> Self
pub fn with_max_admins_per_welcome(self, limit: usize) -> Self
Sourcepub fn with_max_relay_url_length(self, limit: usize) -> Self
pub fn with_max_relay_url_length(self, limit: usize) -> Self
Trait Implementations§
Source§impl Clone for ValidationLimits
impl Clone for ValidationLimits
Source§fn clone(&self) -> ValidationLimits
fn clone(&self) -> ValidationLimits
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidationLimits
impl Debug for ValidationLimits
Source§impl Default for ValidationLimits
impl Default for ValidationLimits
impl Copy for ValidationLimits
Auto Trait Implementations§
impl Freeze for ValidationLimits
impl RefUnwindSafe for ValidationLimits
impl Send for ValidationLimits
impl Sync for ValidationLimits
impl Unpin for ValidationLimits
impl UnsafeUnpin for ValidationLimits
impl UnwindSafe for ValidationLimits
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more