#protocols #packets #networking #http #packet #assistance

packeteer

An attempt at a Rust library that can be used to assist in programmatically analysing, serving and handling received protocol packets

17 releases

new 0.5.3 Jul 10, 2024
0.5.2 Jan 15, 2024
0.5.1 Jul 17, 2023
0.4.3 Apr 13, 2022
0.1.4 Mar 12, 2022

#1140 in Network programming

Download history 18/week @ 2024-03-31 148/week @ 2024-07-07

148 downloads per month

EUPL-1.2

41KB
775 lines

Packeteer

Packeteer is a library that can handle programatically structuring protocol packets as well as generating, constructing from raw, and unpacking depending on the protocol.

Supported protocols

  • HTTP/1.x
  • Gemini
  • FTP
  • DNS

What Packeteer is not

  • a TCP/UDP stream handling library
  • a server
  • a protocol client
  • the only way to do this, probably

lib.rs:

A packet manipulation, generation, unpackination, and constructionation station.

In all seriousness, packeteer is a crate made to assist with programmatically analysing, serving and handling received protocol packets. This is great for servers, clients, proxies as well as packet sniffers, capturers and analysers. Packeteer doesn't implement any ability to send or receive requests/responses nor does it handle streams or threads for you and is instead supposed to be used in applications to structure packets and potentially do automated operations on them as defined by packeteer modules.

To include packeteer in your project, you'll need to enable the modules you need. For example, if you required the usage of the http1 module, you would add the following to your Cargo.toml file:

packeteer = { version = "0.4", features = ["http1"] }

It's safe to use ambigious version numbers that exclude the bugfix number as breaking changes or new features will result in an increment of the minor version number, or possibly major version number in the future.

Packeteer aims to use as little dependencies as possible. The less dependenices that packeteer uses, the less storage your project uses. Being conservative with dependencies also makes compilation infinitely faster.

An example of request generation using the http1 module:

use packeteer::http1::*;

fn main() {
	// generate_request(method, host, location, body)
	// GET requests don't really require bodies.
	let request = generate_request("GET", "example.service", "/api/example_endpoint", "");
	let req_raw = unpack_request(request);

	// Now to send req_raw through a stream to your client!
}

No runtime deps

Features