pub struct KeepaliveConfig {
pub interval: Duration,
pub timeout: Duration,
pub max_missed: u32,
pub enabled: bool,
pub adaptive: bool,
}Expand description
Configuration for the keepalive mechanism.
Fields§
§interval: DurationHow often to send a keepalive ping.
timeout: DurationHow long to wait for a pong before counting a miss.
max_missed: u32How many consecutive missed pongs before declaring the connection dead.
enabled: boolWhether keepalive is enabled.
adaptive: boolAdaptive mode — adjusts interval based on measured RTT.
Implementations§
Source§impl KeepaliveConfig
impl KeepaliveConfig
Sourcepub fn mobile() -> Self
pub fn mobile() -> Self
Mobile network preset — aggressive keepalive for МТС/Beeline/МегаФон. These operators drop NAT entries after ~30s of silence.
Sourcepub fn datacenter() -> Self
pub fn datacenter() -> Self
Data center / server preset.
Sourcepub fn aggressive() -> Self
pub fn aggressive() -> Self
Aggressive preset — same as mobile, explicit alias.
Sourcepub fn from_preset(preset: KeepalivePreset) -> Self
pub fn from_preset(preset: KeepalivePreset) -> Self
Create from a KeepalivePreset.
Trait Implementations§
Source§impl Clone for KeepaliveConfig
impl Clone for KeepaliveConfig
Source§fn clone(&self) -> KeepaliveConfig
fn clone(&self) -> KeepaliveConfig
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 KeepaliveConfig
impl Debug for KeepaliveConfig
Auto Trait Implementations§
impl Freeze for KeepaliveConfig
impl RefUnwindSafe for KeepaliveConfig
impl Send for KeepaliveConfig
impl Sync for KeepaliveConfig
impl Unpin for KeepaliveConfig
impl UnsafeUnpin for KeepaliveConfig
impl UnwindSafe for KeepaliveConfig
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