Struct path::Path
[−]
[src]
pub struct Path<K, C> where
K: Hash + Eq + PartialEq, { pub timeout: Duration, pub max_connections: u64, // some fields omitted }
Global connection tracking structure
Fields
timeout: Duration
A general connection timeout, per default 10 minutes
max_connections: u64
Maximum amount of flows within the HashMap, per default 1 million
Methods
impl<K, C> Path<K, C> where
C: Clone,
K: Debug + Clone + Hash + Eq + PartialEq,
[src]
C: Clone,
K: Debug + Clone + Hash + Eq + PartialEq,
fn new() -> Self
Create a new Path
instance with a timeout of 10 minutes and 1 million connections at a
maximum
Examples
use path::Path; let path :Path<u8, u8> = Path::new();
fn set_log_level(self, level: LogLevel) -> Self
Set the global log level for reporting
Examples
use log::LogLevel; use path::Path; let path :Path<u8, u8> = Path::new().set_log_level(LogLevel::Trace);
fn track(&mut self, identifier: Identifier<K>) -> PathResult<Connection<K, C>>
Track a connection based on its Identifier
Examples
use path::{Path, Identifier}; use std::net::{IpAddr, Ipv4Addr}; let mut path :Path<u8, u8> = Path::new(); let identifier = Identifier::new(IpAddr::V4(Ipv4Addr::new(10, 0, 0, 1)), 1234, IpAddr::V4(Ipv4Addr::new(10, 0, 0, 2)), 443, 6); let connection = path.track(identifier).unwrap(); assert_eq!(connection.data.custom, None); assert_eq!(connection.data.packet_counter(), 1);
fn connection_count(&self) -> usize
Get the number of actual tracked connections
fn last_mut(&mut self) -> Option<Connection<K, C>>
Retrieve the last Connection
as a mutable reference if available
fn remove(&mut self, identifier: &Identifier<K>)
Remove a connection
fn flush(&mut self) -> Vec<Identifier<K>>
Remove all connections which have a timeout and return them in a vector
Trait Implementations
impl<K: Debug, C: Debug> Debug for Path<K, C> where
K: Hash + Eq + PartialEq,
[src]
K: Hash + Eq + PartialEq,
impl<K: Clone, C: Clone> Clone for Path<K, C> where
K: Hash + Eq + PartialEq,
[src]
K: Hash + Eq + PartialEq,
fn clone(&self) -> Path<K, C>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<K: PartialEq, C: PartialEq> PartialEq for Path<K, C> where
K: Hash + Eq + PartialEq,
[src]
K: Hash + Eq + PartialEq,
fn eq(&self, __arg_0: &Path<K, C>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Path<K, C>) -> bool
This method tests for !=
.
impl<K: Eq, C: Eq> Eq for Path<K, C> where
K: Hash + Eq + PartialEq,
[src]
K: Hash + Eq + PartialEq,