afpacket 0.2.3

Bindings for Linux raw packet sockets (AF_PACKET), and an async wrapper
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use afpacket::sync::RawPacketStream;
use std::io::Read;
use nom::HexDisplay;

fn main() {
    let mut ps = RawPacketStream::new().unwrap();
    loop {
        let mut buf = [0u8; 1500];
        ps.read(&mut buf).unwrap();
        println!("{}", buf.to_hex(24));
    }
}