Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/elenaf9/p2p-poc

Basic PoC for the implementation of a Peer-to-Peer Network using the rust-libp2p library
https://github.com/elenaf9/p2p-poc

hacktoberfest libp2p peer-to-peer

Last synced: 5 days ago
JSON representation

Basic PoC for the implementation of a Peer-to-Peer Network using the rust-libp2p library

Awesome Lists containing this project

README

        

# p2p-poc

Basic Mailbox that enables different peers to communicate with each other.
In order to provide a message / record for a remote peer, a local peer adds this information to a key-value-store mailbox that runs on a server. The mailbox publishes this record in their kademlia DHT, from which the remote peer can then read the value if they know the key.

**This was only the PoC to start digging into the concepts and protocols of libp2p. Any further development and the library-version of this exists within [elenaf9/p2p](https://github.com/elenaf9/p2p)**.

## Getting started

` cargo run`

optional arguments:
- `--port ` to set a port that this peer listens to within the same network, default is 16384
- `--mailbox ` to connect to a mailbox, the arguments should be entered within string quotes.

## command line interface

All values shoul be entered within typical string-quotes, apart from the timeout_sec, which is a numeric value without quotes.
- `LIST`: list all the entries within the kademlia bucket of the peer
- `PING ` Ping a remote peer in order to test the connection. This only works with peers that has been discovered and are listed in the kademlia bucket
- `GET ` Get the stored key-value pair for this key from either the own kademlia store or from the mailbox. Keys have to be alphanumeric.
- `PUT ` Add a record to the mailbox, key should be alphanumeric, values may contain any chars apart from '"'. The optional timeout_sec should be a numeric value and it describes the duration that this record is available on the mailbox. If no timeout is given, it will be the default value of 90000sec/15min.

## libp2p protocols

- libp2p-noise for authentication
- libp2p-kademlia DHT for peer discovery and publishing / reading records
- libp2p-mdns for peer discovery within a local network
- implementation of the libp2p-request-response protocol for custom Request/Response Messages