ether 0.1.4

Library for parsing and manipulating network data, packet captures.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

extern crate ether;
use ether::tap;

fn main() {
    // let mut tap = tap::Tap::new("en0").unwrap();
    let mut tap = tap::Tap::new("lo0").unwrap();

    let mut sink = tap.sink();

    // UDP/IPv4 (`echo 'test' | nc -u localhost 2389`)
    let data = [69, 0, 0, 33, 178, 156, 0, 0, 64, 17, 0, 0, 127, 0, 0, 1, 127, 0, 0, 1, 240, 186,
                9, 85, 0, 13, 254, 32, 116, 101, 115, 116, 10];
    sink.send(&data).unwrap();
}