pub struct ConnectionInfo {
pub session_id: SessionId,
pub remote_addr: String,
pub local_port: u16,
pub protocol: String,
pub connected_at: DateTime<Utc>,
pub bytes_sent: u64,
pub bytes_received: u64,
pub packets_sent: u64,
pub packets_received: u64,
pub rtt_ms: Option<u32>,
}Expand description
Connection info for network tracking
Fields§
§session_id: SessionIdSession this connection belongs to
remote_addr: StringRemote address
local_port: u16Local port
protocol: StringProtocol (TCP, UDP, QUIC)
connected_at: DateTime<Utc>Connection established time
bytes_sent: u64Bytes sent
bytes_received: u64Bytes received
packets_sent: u64Packets sent (for UDP)
packets_received: u64Packets received (for UDP)
rtt_ms: Option<u32>Round-trip time estimate
Implementations§
Source§impl ConnectionInfo
impl ConnectionInfo
Sourcepub fn new(
session_id: SessionId,
remote_addr: impl Into<String>,
protocol: impl Into<String>,
) -> Self
pub fn new( session_id: SessionId, remote_addr: impl Into<String>, protocol: impl Into<String>, ) -> Self
Create new connection info
Sourcepub fn update_stats(&mut self, sent: u64, received: u64)
pub fn update_stats(&mut self, sent: u64, received: u64)
Update traffic stats
Sourcepub fn update_packets(&mut self, sent: u64, received: u64)
pub fn update_packets(&mut self, sent: u64, received: u64)
Update packet stats
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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectionInfo
impl Debug for ConnectionInfo
Source§impl<'de> Deserialize<'de> for ConnectionInfo
impl<'de> Deserialize<'de> for ConnectionInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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
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