packet
This crate allows the parsing and creation of various network packets with an ergonomic API.
Usage
First, add the following to your Cargo.toml
:
[]
= "0.1"
Next, add this to your crate root:
extern crate packet;
Examples
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();
}