pub struct ProtectionManager { /* private fields */ }Expand description
限频保护器
Implementations§
Source§impl ProtectionManager
impl ProtectionManager
pub fn new() -> Self
Sourcepub fn check_freq_limit(&self, conn_id: u64, proto_id: u32) -> bool
pub fn check_freq_limit(&self, conn_id: u64, proto_id: u32) -> bool
检查请求是否超频
返回 true 表示被限频(应拒绝),false 表示通过
Sourcepub fn check_replay(&self, conn_id: u64, serial_no: u32) -> bool
pub fn check_replay(&self, conn_id: u64, serial_no: u32) -> bool
检查防重放(serial number 必须递增)
返回 true 表示可能是重放攻击,false 表示正常
Sourcepub fn on_disconnect(&self, conn_id: u64)
pub fn on_disconnect(&self, conn_id: u64)
连接断开时清理
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ProtectionManager
impl !RefUnwindSafe for ProtectionManager
impl Send for ProtectionManager
impl Sync for ProtectionManager
impl Unpin for ProtectionManager
impl UnwindSafe for ProtectionManager
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