pub struct SecureWebSocketHandler { /* private fields */ }Expand description
Security-enhanced WebSocket handler with rate limiting
Implementations§
Source§impl SecureWebSocketHandler
impl SecureWebSocketHandler
Sourcepub fn new(rate_limit_config: RateLimitConfig) -> Self
pub fn new(rate_limit_config: RateLimitConfig) -> Self
Create new secure handler with rate limiting configuration
Sourcepub fn with_default_security() -> Self
pub fn with_default_security() -> Self
Create with default security configuration
Sourcepub fn with_high_traffic_security() -> Self
pub fn with_high_traffic_security() -> Self
Create with high-traffic configuration
Sourcepub fn with_low_resource_security() -> Self
pub fn with_low_resource_security() -> Self
Create with low-resource configuration
Sourcepub fn check_upgrade_request(
&self,
client_ip: IpAddr,
) -> Result<(), RateLimitError>
pub fn check_upgrade_request( &self, client_ip: IpAddr, ) -> Result<(), RateLimitError>
Check if HTTP upgrade request is allowed
Sourcepub fn create_connection_guard(
&self,
client_ip: IpAddr,
) -> Result<RateLimitGuard, RateLimitError>
pub fn create_connection_guard( &self, client_ip: IpAddr, ) -> Result<RateLimitGuard, RateLimitError>
Create connection guard for a new WebSocket connection
Sourcepub fn validate_message(
&self,
guard: &RateLimitGuard,
frame_size: usize,
) -> Result<(), RateLimitError>
pub fn validate_message( &self, guard: &RateLimitGuard, frame_size: usize, ) -> Result<(), RateLimitError>
Validate WebSocket message before processing
Sourcepub fn get_security_stats(&self) -> RateLimitStats
pub fn get_security_stats(&self) -> RateLimitStats
Get current rate limiting statistics
Sourcepub fn force_cleanup(&self)
pub fn force_cleanup(&self)
Force cleanup of expired rate limit entries
Trait Implementations§
Source§impl Clone for SecureWebSocketHandler
impl Clone for SecureWebSocketHandler
Auto Trait Implementations§
impl Freeze for SecureWebSocketHandler
impl !RefUnwindSafe for SecureWebSocketHandler
impl Send for SecureWebSocketHandler
impl Sync for SecureWebSocketHandler
impl Unpin for SecureWebSocketHandler
impl UnsafeUnpin for SecureWebSocketHandler
impl !UnwindSafe for SecureWebSocketHandler
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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