denis2glez / p2p-handshake

Simple implementation of a TLS handshake on a P2P network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ”Ž Content

πŸ€” About

This repo began as an exploration of a simple implementation of a TLS handshake on a peer-to-peer (P2P) network and led to a more in-depth study of the popular P2P networking framework libp2p, and, in particular, of the Rust implementation rust-libp2p.

Important

This repository is still a work in progress and includes code that is being merged into the upstream rust-libp2p project.

For futher information, see the docs.

🏁 Getting Started

To use your host system as development enviroment install the following dependencies.

Tip

In any case, you can check below for suggestions on how to install the prerequisites on your system.

Linux (Debian/Ubuntu)

If you are using Debian or a derivative (e.g. Ubuntu, Linux Mint), it is recommended to install Rust using the standard installation script. You could install all the development dependencies by running the following commands.

sudo apt install curl git docker protobuf-compiler
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
macOS

If you are using macOS you could install all the development dependencies using Homebrew by running the following commands.

brew install curl git docker protobuf
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Windows

If you are using Windows, you could install most of the required dependencies using the winget CLI tool by running the following commands.

winget install --id Git.Git
winget install --id Docker.DockerDesktop
winget install --id Rustlang.Rust.MSVC

You can probably run the shell scripts on your Windows system if you use Git Bash, but it is recommended to use the Windows Subsystem for Linux (WSL) instead as development environment and follow the suggestions for Debian/Ubuntu.

πŸ”§ Development

Once you have a development environment configured with all the necessary dependencies, you can perform any of the following tasks.

Quick check

Quickly check the package and all of its dependencies for possible errors

cargo check

Build

To build the packages use

cargo build

Run tests

First we need to start a private Celestia network with single validator and bridge

docker compose -f docker/docker-compose.yml up --build --force-recreate -d

We then generate the authentication tokens that will be used by the tests

scripts/gen_auth_tokens.sh

Now we can run all the default tests

cargo test

or just a specific group of tests, by adding -- <pattern> to filter.

To conclude, shutdown the private Celestia network

docker compose -f docker/docker-compose.yml down

πŸš€ Deployment

You can use any of the tarballs in the Releases section to deploy the software according to your requirements. These are automatically generated using the release workflow after tagging a new version.

πŸŽ‰ Acknowledgements

Thanks to all the developers of the libraries used throughout the project.

πŸ“ License

This project is licensed under the MIT license.

About

Simple implementation of a TLS handshake on a P2P network

License:MIT License


Languages

Language:Rust 89.5%Language:Shell 10.5%