-
-
Notifications
You must be signed in to change notification settings - Fork 187
Running a node with dhtnode
dhtnode is a command-line utility included with OpenDHT to run, control and monitor an OpenDHT node.
Run a standalone DHT node:
docker run -d -p4222:4222/udp ghcr.io/savoirfairelinux/opendht/opendht-alpine dhtnode -b bootstrap.jami.net -p 4222 -s
Run a DHT proxy server on port 8000:
docker run -d -p8000:8000/tcp -p4222:4222/udp ghcr.io/savoirfairelinux/opendht/opendht-alpine dhtnode -b bootstrap.jami.net -p 4222 --proxyserver 8000 -s
Then you can use your node as a bootstrap for any services that use opendht. Port 4222 will be used.
OpenDHT includes a systemd service for dhtnode starting from version 1.3.4.
To use it, build OpenDHT using CMake with the argument -DOPENDHT_SYSTEMD=On.
See Build the library for details about how to build OpenDHT.
Once installed, start the dhtnode service using:
systemctl start dhtnode
Or enable dhtnode to run automatically on startup using:
systemctl enable dhtnode
Note: The default bootstrap server and port (DHT_ARGS) are specified in the /etc/dhtnode.conf file. It is also possible to change the default value of DHT_ARGS via tools/systemd/dhtnode.conf prior to compilation.
dhtnode [-p local_port] [-b bootstrap_host:port] [-n netid] [-i] [-D] [-f] [-v [-l logfile|-L]] [-s|-d]
-
-ballows to specify a bootstrap node address (can be any running node of the DHT network) -
-pallows to specify the local UDP port to bind (optional). If not set, will use any available port. Note that the default OpenDHT port (to ideally use for public nodes) is4222 -
-nallows to specify a network id (integer). Nodes with different network ids won't talk to each other. Defaults to the main public network (network id0) -
-Denables the multicast automatic local peer discovery mechanism -
-fallows to specify a file path to persist/load the node state (routing table and values) -
-venables logging, to standard output by default -
-Llogs to syslog -
-llogs to a specified file path -
-senables service mode (non-forking daemon) -
-denables daemon mode (forking daemon,-vlogs to syslog by default) -
-ienables generating a DHT "identity" with the node (RSA key pair, and certificate published on the DHT). Required to perform cryptographic operations (encrypt/sign values) if no private key file is provided. -
--save-identitysave generated identity (certificate and private key) to given file prefix -
--privkeyload identity private key from given file. Required to perform cryptographic operations if no identity is generated. -
--privkey-passworduse private key password when loading and saving a private key from file. -
--certificateload identity certificate from given file. If specified, the certificate is published on the DHT. -
--proxyserverspecify a port to run a proxy server -
--proxyclientuse the proxyserver specified
for instance:
dhtnode -b bootstrap.jami.net:4222 will run a node and use bootstrap.jami.net port 4222 as a bootstrap node.
dhtnode -b bootstrap.jami.net:4222 --proxyserver 8000 will run a proxy server on port 8000.
dhtnode --proxyclient dhtproxy.jami.net:80 will use dhtproxy.jami.net port 80 as a proxy.
Show a command list with usage.
Bootstrap/ping a DHT node. Similar to providing -b host:port as a command line parameter.
Get values for {key} (the key is a 40 hexadecimal characters string).
Listen for value changes at {key} (the key is a 40 hexadecimal characters string).
Put the text value {string_value} at {key}.