p2ps 0.2.0

Easy to implement security for p2p connections
Documentation
p2ps-0.2.0 has been yanked.

p2ps

p2ps is a Rust library designed to make it easy to establish a secure connection between two peers using the Diffie-Hellman algorithm.

Usage example (see tests for better understanding)

Peer A

use tokio::net::TcpListener;
use p2ps::Seconn;

let listener = TcpListener::bind("127.0.0.1:7777").await?;
let (stream, _) = listener.accept().await?;
let mut p2ps_conn = Seconn::listen_handshake(stream).await?;

Peer B

use tokio::net::TcpStream;
use p2ps::Seconn;

let stream = TcpStream::connect("127.0.0.1:7777").await?;
let mut p2ps_conn = Seconn::send_handshake(stream).await?;

now both peers can use their p2ps_conn to share data

Peer A

let data = b"Hello, peer B!";
p2ps_conn.write(data).await?;

Peer B

let decrypted_data = p2ps_conn.read().await?;
println!("Received: {}", String::from_utf8_lossy(&decrypted_data));

Loking for Contributors & Ideas

This project is in active development, and I need help! Contributions are welcome, whether it's improving the implementation, fixing bugs, or adding new features. Feel free to open issues, submit pull requests, and share any new ideas that could improve the project.

License

This project is licensed under the MIT License – see the LICENSE file for details.