Skip to content

Latest commit

 

History

History
52 lines (32 loc) · 2.95 KB

README.md

File metadata and controls

52 lines (32 loc) · 2.95 KB

sifis-dht

Actions Status CodeCov LICENSE

The SIFIS-HOME DHT is a component that offers a completely distributed publish/subscribe mechanism through which SIFIS-HOME applications can exchange messages.

The SIFIS-HOME DHT allows to publish both persistent and volatile messages. Persistent messages are messages that need to be stored in a persistent way, so that they are available even after a node reboot operation. Volatile messages are instead messages that need to be delivered to all the available applications but that do not need to be persisted on disk. The SIFIS-HOME DHT has a built-in mechanism to solve possible data conflicts that can arise when a network partition occurs. In detail, every time a message is published on the DHT, the DHT also stores its publication timestamp. Then, the publication timestamp is used to assure that only the most recently published messages will be stored and made available to the applications.

Build

cargo build --release

You can find the sifis-dht executable in the target/release folder.

Test

cargo test

Usage

sifis-dht <SQLITE_FILE> <PRIVATE_KEY_FILE> <IS_PERSISTENT_CACHE> <SHARED_KEY> <HTTP_PORT> <LOOPBACK_ONLY>

where

SQLITE_FILE: absolute path of the sqlite file where persistent messages published on the DHT are stored.

PRIVATE_KEY_FILE: path to the file containing the private key of the node in PEM format. A 2048 bytes long private key file in PEM format can be generated using command "openssl genrsa -out private.pem 2048". If private_key_file does not exist, the key pair is automatically generated by sifis-dht and stored inside file private_key_file .

IS_PERSISTENT_CACHE: if set to true indicates that sifis-dht is authorized to write messages to the provided sqlite file. If set to false, the SQLITE_FILE content will only be used to initialize the cache.

SHARED_KEY: 32 bytes long shared key in hex format (command "openssl rand -hex 32" can be used to generate a random key)

HTTP_PORT: port to be used for the HTTP interface

LOOPBACK_ONLY: if set to true, only the loopback interface will be used, meaning that only other local instances of sifis-dht are discovered. If set to false, all the available network interfaces of the device will be used. Hence, two sifis-dht instances running on the same local network should discover each other.

Acknowledgements