4 releases

0.1.2 Jun 20, 2022
0.1.1 Jun 15, 2022
0.1.0 Jun 15, 2022
0.0.1 Jun 15, 2022

#3 in #anonymization

BSD-3-Clause

9KB
72 lines

hexpawb

hexpawb is a Rust library to programmatically interface with the HexPawb network. For more details, see the main repository. For protocol details, check the wiki.


lib.rs:

This crate presents a clean and simple interface to the HexPawb network. If you wanted to, say, load https://www.torproject.org/ through HexPawb, you'd just need to:

use hexpawb::Network;
// First you need to connect to the HexPawb network
let mut network = Network::connect().await
.expect("Failed to join network");
// Then you can create a circuit
let mut circuit = network.circuit().await
.expect("Failed to build circuit");
// Then you can connect to something over that circuit (this does DNS
// through the circuit, but to your system's configured DNS servers)
let mut connection = circuit.tcp("www.torproject.org:80").await
.expect("Failed to connect circuit");
// TCP connections work basically just like the stdlib's TcpStream,
// but async.
connection.send("GET / HTTP/1.1\r\nConnection: close\r\n\r\n").await
.expect("Failed to send request");
std::io::copy(circuit, std::io::stdout().lock()).await
.expect("Failed to receive body");

Breaking privacy

If and only if you know exactly what you're doing and you can state in clear, uncertain terms precisely why you need to do it, you can enable the lower-level API with feature dangerous-low-level-bits. If you don't use it exactly right, you'll break your own anonymity irrecoverably. This enables functionality like:

use hexpawb::Network;
let mut network = Network::builder()
.authority(custom_authority)
.connect().await
.expect("Failed to join network");
let mut circuit = network.tcp("www.torproject.org:90")
.length(10)
.relay(specific_relay)
.connect().await
.expect("Failed to connect circuit");
circuit.send("GET / HTTP/1.1\r\nConnection: close\r\n\r\n").await
.expect("Failed to send request");
std::io::copy(circuit, std::io::stdout().lock()).await
.expect("Failed to receive body");

Dependencies

~1MB
~16K SLoC