p2ps

Crates.iop2ps
lib.rsp2ps
version0.2.0
created_at2025-02-19 03:38:53.666384+00
updated_at2025-06-18 22:58:42.235506+00
descriptionEasy to implement security for p2p connections
homepage
repositoryhttps://github.com/Bicheka/p2ps
max_upload_size
id1560908
size38,801
David Martinez Gil (Bicheka)

documentation

README

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.

Commit count: 72

cargo fmt