pub struct ConnectionInfo {
pub session_id: SessionId,
pub local_addr: SocketAddr,
pub peer_addr: SocketAddr,
pub protocol: String,
pub state: ConnectionState,
pub established_at: SystemTime,
pub closed_at: Option<SystemTime>,
pub last_activity: SystemTime,
pub packets_sent: u64,
pub packets_received: u64,
pub bytes_sent: u64,
pub bytes_received: u64,
}
Expand description
Connection information
Fields§
§session_id: SessionId
Session ID
local_addr: SocketAddr
Local address
peer_addr: SocketAddr
Remote address
protocol: String
Protocol type
state: ConnectionState
Connection state
established_at: SystemTime
Established time
closed_at: Option<SystemTime>
Closed time
last_activity: SystemTime
Last activity time
packets_sent: u64
Packets sent count
packets_received: u64
Packets received count
bytes_sent: u64
Bytes sent count
bytes_received: u64
Bytes received count
Implementations§
Source§impl ConnectionInfo
impl ConnectionInfo
pub fn update_activity(&mut self)
pub fn record_packet_sent(&mut self, size: usize)
pub fn record_packet_received(&mut self, size: usize)
pub fn connection_duration(&self) -> Duration
pub fn idle_duration(&self) -> Duration
Trait Implementations§
Source§impl Clone for ConnectionInfo
impl Clone for ConnectionInfo
Source§fn clone(&self) -> ConnectionInfo
fn clone(&self) -> ConnectionInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ConnectionInfo
impl Debug for ConnectionInfo
Auto Trait Implementations§
impl Freeze for ConnectionInfo
impl RefUnwindSafe for ConnectionInfo
impl Send for ConnectionInfo
impl Sync for ConnectionInfo
impl Unpin for ConnectionInfo
impl UnwindSafe for ConnectionInfo
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