https://github.com/manuels/bulletinboard-dht
BulletinBoard is a general-purpose Distributed-Hash-Table based on Kademlia.
The interface is provided as a D-Bus service via these commands (see example below or python example):
Service: org.manuel.BulletinBoard
Object Path: /
Interface: org.manuel.BulletinBoard
Commands:
- Store(app_id: str, key: [u8], value: [u8], lifetime_sec: u64)
- Put(app_id: str, key: [u8], value: [u8])
- Get(app_id: str, key: [u8]) -> (values: [[u8]])
Please note that the value must not exceed 2048 bytes!
The lifetime for a value you Put() in the DHT is 15 minutes, so you should call Put() every, say, 10 minutes to make sure it stays in the DHT (or just use Store()).
-
Download
# Debian/Ubuntu wget 'https://github.com/manuels/bulletinboard-dht/releases/download/v0.5.3/bulletinboard_0.5.3_amd64.deb' # Fedora wget 'https://github.com/manuels/bulletinboard-dht/releases/download/v0.5.3/bulletinboard-0.5.3-1.x86_64.rpm'
-
Install bulletinboard
# Debian/Ubuntu sudo dpkg -i bulletinboard_0.5.3_amd64.deb # Fedora sudo rpm -ivh bulletinboard-0.5.3.x86_64.rpm
Usually BulletinBoard is used by any third-party applications to store and lookup data. You can use the DBus interface to do this by hand for example in your shell scripts.
The Put() command stores data in the DHT. In this example we store under the key what did you eat? the value [8B,AD,F0,0D] using the application ID mytestapp:
$ dbus-send --session \
--type=method_call \
--dest=org.manuel.BulletinBoard / \
org.manuel.BulletinBoard.Put \
string:"mytestapp" \
array:byte:"what did you eat?" \
array:byte:0x8B,0xAD,0xF0,0x0D
Now we can get the stored data by asking the DHT what is stored under the key what did you eat?. Using the Get() command, we get back the [8B,AD,F0,0D] value we stored previously:
$ dbus-send --session \
--reply-timeout=60000 \
--print-reply \
--type=method_call \
--dest=org.manuel.BulletinBoard / \
org.manuel.BulletinBoard.Get \
string:"mytestapp" \
array:byte:"what did you eat?"
array [
array of bytes [
8B AD F0 0D
]
]
-
Get Rust
-
Clone
git clone https://github.com/manuels/bulletinboard-dht.git
-
Build
cargo build --release
(in bulletinboard-dht dir)