5 releases

0.0.6 Dec 27, 2018
0.0.5 Oct 27, 2018
0.0.4 Sep 11, 2018
0.0.2 Mar 6, 2018
0.0.1 Mar 6, 2018

#43 in Multimedia

Download history 7/week @ 2018-10-28 22/week @ 2018-11-04 16/week @ 2018-11-11 9/week @ 2018-11-18 6/week @ 2018-11-25 27/week @ 2018-12-02 17/week @ 2018-12-09 8/week @ 2018-12-16 46/week @ 2018-12-23 19/week @ 2018-12-30 3/week @ 2019-01-06 10/week @ 2019-01-13

76 downloads per month

MIT license

699 lines

Tox Bootstrap Node

A server application to run tox bootstrap node.

Building and running

You'll need Rust >= 1.31.0.

Build with:

cargo build --release

Run with:

cargo run --release

If you want to change default log level you can do it via setting RUST_LOG environment variable. For example, if you want to see all received and sent packets you can change log level to trace for tox crate:

RUST_LOG=tox=trace cargo run --release

Also it's possible to use syslog via --log-type parameter.


MOTD is an abbreviation for The Message of The Day. Tox bootstrap nodes have a special packet kind called BootstrapInfo to retrieve the MOTD alongside with version. Our node supports basic templates for the MOTD that can be specified via --motd key. It's possible to use the following variables surrounded by {{ }}:

  • start_date: time when the node was started
  • uptime: uptime in the format 'XX days XX hours XX minutes'
  • tcp_packets_in: counter of tcp incoming packets
  • tcp_packets_out: counter of tcp outgoing packets
  • udp_packets_in: counter of udp incoming packets
  • udp_packets_out: counter of udp outgoing packets

Keys generation

In order to run node you have to provide either secret key or path to a keys file.

Keys file

Keys file is a binary file with sequentially stored public and secret keys. Path to a keys file can be specified via --keys-file argument. If file doesn't exist it will be created with automatically generated keys. The format of this file is compatible with tox-bootstrapd.

You may also extract the key from the file:

hexdump -s32 -e '32/1 "%02x" "\n"' ./key

Secret key

Secret key is a hexadecimal string of size 32 bytes. It can be specified via TOX_SECRET_KEY environment variable. Any random string will fit but note that only strong random generators should be used to generate a secret key. Here are some examples how you can do it in the terminal:

openssl rand -hex 32
hexdump -n 32 -e '8 "%08x" 1 "\n"' /dev/random
od -vN 32 -An -tx1 /dev/random | tr -d " \n" ; echo

Config or CLI

In order to run with config, run with --config <file>. Example config.yml is below.

log-type: Stderr
keys-file: ./keys
motd: "{{start_date}} {{uptime}} Tcp: incoming {{tcp_packets_in}}, outgoing {{tcp_packets_out}}, Udp: incoming {{udp_packets_in}}, outgoing {{udp_packets_out}}"
  - pk: 1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F
  - pk: DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43
threads: auto # or any u16 > 0
lan-discovery: True

Or you can use it with CLI like this

tox-node --keys-file keys \
    --bootstrap-node 1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F \
    --udp-address '' --tcp-address '' \
    --motd "{{start_date}} {{uptime}} Tcp: incoming {{tcp_packets_in}}, outgoing {{tcp_packets_out}}, Udp: incoming {{udp_packets_in}}, outgoing {{udp_packets_out}}"


~196K SLoC