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

A general connection timeout, per default 10 minutes

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]

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();

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);

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);

Get the number of actual tracked connections

Retrieve the last Connection as a mutable reference if available

Remove a connection

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]

Formats the value using the given formatter.

impl<K: Clone, C: Clone> Clone for Path<K, C> where
    K: Hash + Eq + PartialEq
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<K: PartialEq, C: PartialEq> PartialEq for Path<K, C> where
    K: Hash + Eq + PartialEq
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<K: Eq, C: Eq> Eq for Path<K, C> where
    K: Hash + Eq + PartialEq
[src]