This crate allows the parsing and creation of various network packets with an ergonomic API.
First, add the following to your Cargo.toml
:
toml
[dependencies]
packet = "0.1"
Next, add this to your crate root:
rust
extern crate packet;
Creating an ICMP packet echo request packet.
``` extern crate packet; use packet::builder::Builder; use packet::icmp;
fn main() { let packet = icmp::Builder::default() .echo().unwrap().request().unwrap() .identifier(42).unwrap() .sequence(2).unwrap() .payload(b"test").unwrap() .build().unwrap(); } ```