10 releases (breaking)

Uses old Rust 2015

0.8.2 Feb 1, 2017
0.7.0 Jan 5, 2017
0.4.0 Dec 25, 2016

#19 in #identification

Download history 23/week @ 2024-03-14 18/week @ 2024-03-21 29/week @ 2024-03-28 29/week @ 2024-04-04 28/week @ 2024-04-11 18/week @ 2024-04-18 16/week @ 2024-04-25 16/week @ 2024-05-02 26/week @ 2024-05-09 25/week @ 2024-05-16 19/week @ 2024-05-23 22/week @ 2024-05-30 17/week @ 2024-06-06 19/week @ 2024-06-13 22/week @ 2024-06-20 9/week @ 2024-06-27

71 downloads per month
Used in peel-ip

MIT license

15KB
234 lines

path

Build Status Build status Coverage Status master doc path License MIT Crates.io doc.rs

IP based connection identification and tracing

This crate is highly inspired by the netfilter project, which provides connection tracking for TCP/IP based protocols. The timeout of a connection (per default 10 minutes) is handled completely internally by using the time crate.

Example usage

use path::{Path, Identifier};
use std::net::{IpAddr, Ipv4Addr};

// Create a new `Path` for tracking `u8` values as custom data
let mut path :Path<u8, u8> = Path::new();

// Build up a new identifier from IP Addresses, their ports, and a key (in this case the IP Protocol)
let identifier = Identifier::new(IpAddr::V4(Ipv4Addr::new(10, 0, 0, 1)), 1234,
                                 IpAddr::V4(Ipv4Addr::new(10, 0, 0, 2)), 443,
                                 6);

// Do the actual work
let connection = path.track(identifier).unwrap();

// Now it is possible to set/get the custom data
assert_eq!(connection.data.custom, None);
assert_eq!(connection.data.packet_counter, 1);

Dependencies

~3.5–5MB
~98K SLoC