pub struct SecurityLayer { /* private fields */ }Expand description
Security middleware layer
Implementations§
Source§impl SecurityLayer
impl SecurityLayer
Sourcepub fn new(config: SecurityConfig) -> Self
pub fn new(config: SecurityConfig) -> Self
Create a new security layer
Sourcepub fn is_ip_allowed(&self, ip: &str) -> bool
pub fn is_ip_allowed(&self, ip: &str) -> bool
Check if IP is allowed based on access control rules
Sourcepub async fn check_rate_limit(&self, ip: &str) -> bool
pub async fn check_rate_limit(&self, ip: &str) -> bool
Check if request should be rate limited
Sourcepub fn check_request_size(&self, headers: &HeaderMap) -> bool
pub fn check_request_size(&self, headers: &HeaderMap) -> bool
Check request size limits
Sourcepub fn add_security_headers(&self, response_headers: &mut HeaderMap)
pub fn add_security_headers(&self, response_headers: &mut HeaderMap)
Add security headers to response
Sourcepub async fn cleanup_expired_states(&self)
pub async fn cleanup_expired_states(&self)
Clean up expired rate limit states
Auto Trait Implementations§
impl Freeze for SecurityLayer
impl !RefUnwindSafe for SecurityLayer
impl Send for SecurityLayer
impl Sync for SecurityLayer
impl Unpin for SecurityLayer
impl UnsafeUnpin for SecurityLayer
impl !UnwindSafe for SecurityLayer
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