From 9b1de38b60a36d8db4665441238d52ff44298ca7 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Sat, 22 Feb 2014 16:54:33 -0500 Subject: [PATCH 1/4] Make Travis build bootstrap daemon again --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ace69e0d..7641d0c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,14 @@ before_script: - cd .. #installing yasm, needed for compiling vpx - sudo apt-get install yasm > /dev/null + #installing libconfig, needed for DHT_bootstrap_daemon + - wget http://www.hyperrealm.com/libconfig/libconfig-1.4.9.tar.gz > /dev/null + - tar -xvzf libconfig-1.4.9.tar.gz > /dev/null + - cd libconfig-1.4.9 + - ./configure > /dev/null + - make -j3 > /dev/null + - sudo make install > /dev/null + - cd .. #installing libopus, needed for audio encoding/decoding - wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz > /dev/null - tar xzf opus-1.0.3.tar.gz > /dev/null @@ -37,7 +45,7 @@ before_script: script: - autoreconf -i - - CFLAGS=-Ofast ./configure + - CFLAGS=-Ofast ./configure --enable-daemon - make -j3 - make check - make dist From 41ad4c40681d8d763844b252c4994339eb523d20 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Sat, 22 Feb 2014 17:00:46 -0500 Subject: [PATCH 2/4] Fixed some dht bootstrap daemon related things in install.md --- INSTALL.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index a7805018..1dc29804 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -49,8 +49,6 @@ On FreeBSD 10+: pkg install automake autoconf ``` -Note that `libconfig-dev` should be >= 1.4. - You should get and install [libsodium](https://github.com/jedisct1/libsodium): ```bash git clone git://github.com/jedisct1/libsodium.git @@ -112,7 +110,7 @@ brew install --HEAD libtoxcore To do it manually: ``` -brew install libtool automake autoconf libconfig libsodium check +brew install libtool automake autoconf libsodium check ``` Then clone this repo and generate makefile: ```bash @@ -234,7 +232,7 @@ While [Toxic](https://github.com/tox/toxic) is no longer in core, a list of Tox - --disable-av disable A/V support (default: auto) see: [libtoxav](#libtoxav) - --enable-phone build phone (default: no) see: [Test phone](#phone) - --enable-ntox build nTox client (default: no) see: [nTox](#ntox) - - --enable-daemon build DHT bootstrap daemon (default: no) see: [Bootstrap daemon](#bootstrapd) + - --enable-daemon build DHT bootstrap daemon (default=no) see: [Bootstrap daemon](#bootstrapd) - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] @@ -335,7 +333,7 @@ Daemon is disabled by default. You can enable it by adding --enable-daemon argum ```bash ./configure --enable-daemon ``` -There is one dependency required for bootstrap daemon: libconfig. +There is one dependency required for bootstrap daemon: `libconfig-dev` >= 1.4. Install on fedora: ```bash @@ -354,6 +352,7 @@ brew install libconfig OS X non-homebrew: Grab the following [package] (http://www.hyperrealm.com/libconfig/), uncompress and install +See this [readme](other\bootstrap_daemon\README.md) on how to set up the bootstrap daemon. From 44c1dfc5fda6393f18ef7b4178c0c32f3d64f357 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Sat, 22 Feb 2014 17:05:12 -0500 Subject: [PATCH 3/4] Enable nTox in Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7641d0c1..49be669f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ before_script: script: - autoreconf -i - - CFLAGS=-Ofast ./configure --enable-daemon + - CFLAGS=-Ofast ./configure --enable-daemon --enable-ntox - make -j3 - make check - make dist From 5a142bb697651693e4ce7654d2f74e688aab8894 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Sat, 22 Feb 2014 17:06:07 -0500 Subject: [PATCH 4/4] Renamed dht server to dht node --- build/Makefile.am | 2 +- docs/TCP_Network.txt | 4 +- docs/updates/DHT.md | 2 +- other/DHT_bootstrap.c | 12 ++-- other/{DHTservers => DHTnodes} | 2 +- other/Makefile.inc | 2 +- .../Makefile.inc | 8 +-- .../README.md | 0 .../conf | 15 ++--- .../tox_bootstrap_daemon.c | 56 +++++++++---------- .../tox_bootstrap_daemon.sh | 0 ...ver_packets.c => bootstrap_node_packets.c} | 6 +- testing/nTox.c | 2 +- toxcore/network.h | 2 +- 14 files changed, 57 insertions(+), 56 deletions(-) rename other/{DHTservers => DHTnodes} (60%) rename other/{bootstrap_serverdaemon => bootstrap_daemon}/Makefile.inc (67%) rename other/{bootstrap_serverdaemon => bootstrap_daemon}/README.md (100%) rename other/{bootstrap_serverdaemon => bootstrap_daemon}/conf (74%) rename other/{bootstrap_serverdaemon => bootstrap_daemon}/tox_bootstrap_daemon.c (85%) rename other/{bootstrap_serverdaemon => bootstrap_daemon}/tox_bootstrap_daemon.sh (100%) rename other/{bootstrap_server_packets.c => bootstrap_node_packets.c} (93%) diff --git a/build/Makefile.am b/build/Makefile.am index 5514a4d5..aa004388 100644 --- a/build/Makefile.am +++ b/build/Makefile.am @@ -8,5 +8,5 @@ include ../toxcore/Makefile.inc include ../toxav/Makefile.inc include ../other/Makefile.inc include ../testing/Makefile.inc -include ../other/bootstrap_serverdaemon/Makefile.inc +include ../other/bootstrap_daemon/Makefile.inc include ../auto_tests/Makefile.inc diff --git a/docs/TCP_Network.txt b/docs/TCP_Network.txt index f44cca71..e8608791 100644 --- a/docs/TCP_Network.txt +++ b/docs/TCP_Network.txt @@ -12,9 +12,9 @@ can use Tox regardless of the quality of their internet connection. How it's probably going to work: 1. Alice, a Tox client on a TCP only network generates a temporary public key -and connects to a bootstrap server. +and connects to a bootstrap node. -2. Using the bootstrap server she find and connects to a couple (exact number +2. Using the bootstrap node she find and connects to a couple (exact number to be determined later) number of random nodes that have TCP relay support. 3. She uses the onion through the TCP relay connections to send friend requests diff --git a/docs/updates/DHT.md b/docs/updates/DHT.md index 79ec8c4b..db825a3c 100644 --- a/docs/updates/DHT.md +++ b/docs/updates/DHT.md @@ -7,7 +7,7 @@ But: Vastly simplified packet format and encryption. Boostrapping: -The first time you install the client we bootstrap it with a node on our servers.(bandwidth should not be a problem as the client only needs to be sent one reply.) +The first time you install the client we bootstrap it with a node. (bandwidth should not be a problem as the client only needs to be sent one reply.) Basics diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index 307f80f6..291d6589 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c @@ -1,7 +1,7 @@ /* DHT boostrap * - * A simple DHT boostrap server for tox. + * A simple DHT boostrap node for tox. * * Copyright (C) 2013 Tox project All Rights Reserved. * @@ -33,8 +33,8 @@ #include "../testing/misc_tools.c" -#ifdef DHT_SERVER_EXTRA_PACKETS -#include "./bootstrap_server_packets.c" +#ifdef DHT_NODE_EXTRA_PACKETS +#include "./bootstrap_node_packets.c" #define DHT_VERSION_NUMBER 1 #define DHT_MOTD "This is a test motd" @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) Onion *onion = new_onion(dht); Onion_Announce *onion_a = new_onion_announce(dht); -#ifdef DHT_SERVER_EXTRA_PACKETS +#ifdef DHT_NODE_EXTRA_PACKETS bootstrap_set_callbacks(dht->net, DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD)); #endif @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) perror("Initialization"); manage_keys(dht); - /* We want our DHT public key to be the same as our internal one since this is a bootstrap server */ + /* We want our DHT public key to be the same as our internal one since this is a bootstrap node */ memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); printf("Public key: "); @@ -166,7 +166,7 @@ int main(int argc, char *argv[]) while (1) { if (is_waiting_for_dht_connection && DHT_isconnected(dht)) { - printf("Connected to other bootstrap server successfully.\n"); + printf("Connected to other bootstrap node successfully.\n"); is_waiting_for_dht_connection = 0; } diff --git a/other/DHTservers b/other/DHTnodes similarity index 60% rename from other/DHTservers rename to other/DHTnodes index 48e1d115..35509931 100644 --- a/other/DHTservers +++ b/other/DHTnodes @@ -1,3 +1,3 @@ As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out. -For a current DHT server list please visit http://wiki.tox.im/Servers +For a current DHT node list please visit http://wiki.tox.im/nodes diff --git a/other/Makefile.inc b/other/Makefile.inc index 5ec2fc2a..72a514ad 100644 --- a/other/Makefile.inc +++ b/other/Makefile.inc @@ -15,5 +15,5 @@ DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \ $(NACL_LIBS) \ $(WINSOCK2_LIBS) -EXTRA_DIST += $(top_srcdir)/other/DHTservers \ +EXTRA_DIST += $(top_srcdir)/other/DHTnodes \ $(top_srcdir)/other/tox.png diff --git a/other/bootstrap_serverdaemon/Makefile.inc b/other/bootstrap_daemon/Makefile.inc similarity index 67% rename from other/bootstrap_serverdaemon/Makefile.inc rename to other/bootstrap_daemon/Makefile.inc index effe59e8..b75d935f 100644 --- a/other/bootstrap_serverdaemon/Makefile.inc +++ b/other/bootstrap_daemon/Makefile.inc @@ -3,10 +3,10 @@ if BUILD_DHT_BOOTSTRAP_DAEMON noinst_PROGRAMS += tox_bootstrap_daemon tox_bootstrap_daemon_SOURCES = \ - ../other/bootstrap_serverdaemon/tox_bootstrap_daemon.c + ../other/bootstrap_daemon/tox_bootstrap_daemon.c tox_bootstrap_daemon_CFLAGS = \ - -I$(top_srcdir)/other/bootstrap_serverdaemon \ + -I$(top_srcdir)/other/bootstrap_daemon \ $(LIBSODIUM_CFLAGS) \ $(NACL_CFLAGS) \ $(LIBCONFIG_CFLAGS) @@ -22,6 +22,6 @@ tox_bootstrap_daemon_LDADD = \ endif EXTRA_DIST += \ - $(top_srcdir)/other/bootstrap_serverdaemon/conf \ - $(top_srcdir)/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh + $(top_srcdir)/other/bootstrap_daemon/conf \ + $(top_srcdir)/other/bootstrap_daemon/tox_bootstrap_daemon.sh \ No newline at end of file diff --git a/other/bootstrap_serverdaemon/README.md b/other/bootstrap_daemon/README.md similarity index 100% rename from other/bootstrap_serverdaemon/README.md rename to other/bootstrap_daemon/README.md diff --git a/other/bootstrap_serverdaemon/conf b/other/bootstrap_daemon/conf similarity index 74% rename from other/bootstrap_serverdaemon/conf rename to other/bootstrap_daemon/conf index 8451d9a0..28e638c1 100644 --- a/other/bootstrap_serverdaemon/conf +++ b/other/bootstrap_daemon/conf @@ -1,4 +1,4 @@ -// ProjectTox dht bootstrap server daemon configuration file. +// ProjectTox dht bootstrap node daemon configuration file. // Listening port. port = 33445 @@ -20,20 +20,21 @@ enable_ipv6 = false // Automatically bootstrap with nodes on local area network. enable_lan_discovery = true -// Any number of servers the daemon will bootstrap itself from. -// Remember to replace the provided example with your own server list. -// You may leave the list empty or remove "bootstrap_servers" complitely, +// Any number of nodes the daemon will bootstrap itself from. +// Remember to replace the provided example with your own node list. +// There is a maintained list of bootstrap nodes on Tox's wiki, if you need it. +// You may leave the list empty or remove "bootstrap_nodes" complitely, // in both cases this will be interpreted as if you don't want to bootstrap // from anyone. -bootstrap_servers = ( - { // Server 1 +bootstrap_nodes = ( + { // Node 1 // Any ipv4 or ipv6, depending if `enable_ipv6` is set or not, and also // any US-ASCII domain name. address = "198.46.136.167" port = 33445 public_key = "728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854" }, - { // Server 2 + { // Node 2 address = "example.org" port = 33445 public_key = "8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858" diff --git a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c b/other/bootstrap_daemon/tox_bootstrap_daemon.c similarity index 85% rename from other/bootstrap_serverdaemon/tox_bootstrap_daemon.c rename to other/bootstrap_daemon/tox_bootstrap_daemon.c index b7684115..66f6436d 100644 --- a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c +++ b/other/bootstrap_daemon/tox_bootstrap_daemon.c @@ -1,6 +1,6 @@ /* tox_bootstrap_daemon.c * - * Tox DHT bootstrap server daemon. + * Tox DHT bootstrap node daemon. * * Copyright (C) 2014 Tox project All Rights Reserved. * @@ -92,7 +92,7 @@ int manage_keys(DHT *dht, char *keys_file_path) fclose(keys_file); - // We want our DHT public key to be the same as our internal one since this is a bootstrap server + // We want our DHT public key to be the same as our internal one since this is a bootstrap node memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); @@ -184,14 +184,14 @@ int get_general_config(char *cfg_file_path, char **pid_file_path, char **keys_fi return 1; } -// Bootstraps servers listed in the config file +// Bootstraps nodes listed in the config file // -// returns 1 on success, some or no bootstrap servers were added +// returns 1 on success, some or no bootstrap nodes were added // 0 on failure, a error accured while parsing config file int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6) { - const char *NAME_BOOTSTRAP_SERVERS = "bootstrap_servers"; + const char *NAME_BOOTSTRAP_NODES = "bootstrap_nodes"; const char *NAME_PUBLIC_KEY = "public_key"; const char *NAME_PORT = "port"; @@ -207,16 +207,16 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6) return 0; } - config_setting_t *server_list = config_lookup(&cfg, NAME_BOOTSTRAP_SERVERS); + config_setting_t *node_list = config_lookup(&cfg, NAME_BOOTSTRAP_NODES); - if (server_list == NULL) { - syslog(LOG_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", NAME_BOOTSTRAP_SERVERS); + if (node_list == NULL) { + syslog(LOG_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", NAME_BOOTSTRAP_NODES); config_destroy(&cfg); return 1; } - if (config_setting_length(server_list) == 0) { - syslog(LOG_WARNING, "No bootstrap servers found. Skipping bootstrapping.\n"); + if (config_setting_length(node_list) == 0) { + syslog(LOG_WARNING, "No bootstrap nodes found. Skipping bootstrapping.\n"); config_destroy(&cfg); return 1; } @@ -225,45 +225,45 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6) const char *bs_address; const char *bs_public_key; - config_setting_t *server; + config_setting_t *node; int i = 0; - while (config_setting_length(server_list)) { + while (config_setting_length(node_list)) { - server = config_setting_get_elem(server_list, 0); + node = config_setting_get_elem(node_list, 0); - if (server == NULL) { + if (node == NULL) { config_destroy(&cfg); return 0; } // Check that all settings are present - if (config_setting_lookup_string(server, NAME_PUBLIC_KEY, &bs_public_key) == CONFIG_FALSE) { - syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_PUBLIC_KEY); + if (config_setting_lookup_string(node, NAME_PUBLIC_KEY, &bs_public_key) == CONFIG_FALSE) { + syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_PUBLIC_KEY); goto next; } - if (config_setting_lookup_int(server, NAME_PORT, &bs_port) == CONFIG_FALSE) { - syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_PORT); + if (config_setting_lookup_int(node, NAME_PORT, &bs_port) == CONFIG_FALSE) { + syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_PORT); goto next; } - if (config_setting_lookup_string(server, NAME_ADDRESS, &bs_address) == CONFIG_FALSE) { - syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_ADDRESS); + if (config_setting_lookup_string(node, NAME_ADDRESS, &bs_address) == CONFIG_FALSE) { + syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_ADDRESS); goto next; } // Process settings if (strlen(bs_public_key) != 64) { - syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %s. Skipping the server.\n", i, NAME_PUBLIC_KEY, + syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n", i, NAME_PUBLIC_KEY, bs_public_key); goto next; } // not (1 <= port <= 65535) if (bs_port < 1 || bs_port > 65535) { - syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %d. Skipping the server.\n", i, NAME_PORT, bs_port); + syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %d. Skipping the node.\n", i, NAME_PORT, bs_port); goto next; } @@ -273,17 +273,17 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6) free(bs_public_key_bin); if (!address_resolved) { - syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %s. Skipping the server.\n", i, NAME_ADDRESS, bs_address); + syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n", i, NAME_ADDRESS, bs_address); goto next; } - syslog(LOG_DEBUG, "Successfully added bootstrap server #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key); + syslog(LOG_DEBUG, "Successfully added bootstrap node #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key); next: // config_setting_lookup_string() allocates string inside and doesn't allow us to free it // so in order to reuse `bs_public_key` and `bs_address` we have to remove the element // which will cause libconfig to free allocated strings - config_setting_remove_elem(server_list, 0); + config_setting_remove_elem(node_list, 0); i++; } @@ -378,9 +378,9 @@ int main(int argc, char *argv[]) } if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) { - syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n"); + syslog(LOG_DEBUG, "List of bootstrap nodes read successfully\n"); } else { - syslog(LOG_ERR, "Couldn't read list of bootstrap servers in %s. Exiting.\n", cfg_file_path); + syslog(LOG_ERR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path); return 1; } @@ -449,7 +449,7 @@ int main(int argc, char *argv[]) networking_poll(dht->net); if (waiting_for_dht_connection && DHT_isconnected(dht)) { - syslog(LOG_DEBUG, "Connected to other bootstrap server successfully.\n"); + syslog(LOG_DEBUG, "Connected to other bootstrap node successfully.\n"); waiting_for_dht_connection = 0; } diff --git a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh b/other/bootstrap_daemon/tox_bootstrap_daemon.sh similarity index 100% rename from other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh rename to other/bootstrap_daemon/tox_bootstrap_daemon.sh diff --git a/other/bootstrap_server_packets.c b/other/bootstrap_node_packets.c similarity index 93% rename from other/bootstrap_server_packets.c rename to other/bootstrap_node_packets.c index c9297535..ea57b0d2 100644 --- a/other/bootstrap_server_packets.c +++ b/other/bootstrap_node_packets.c @@ -1,8 +1,8 @@ -/* bootstrap_server_packets.c +/* bootstrap_node_packets.c * - * Special bootstrap server only packets. + * Special bootstrap node only packets. * - * Include it in your bootstrap server and use: bootstrap_set_callbacks() to enable. + * Include it in your bootstrap node and use: bootstrap_set_callbacks() to enable. * * Copyright (C) 2013 Tox project All Rights Reserved. * diff --git a/testing/nTox.c b/testing/nTox.c index 8f7dc7ea..9d3eb9c0 100644 --- a/testing/nTox.c +++ b/testing/nTox.c @@ -995,7 +995,7 @@ void print_help(char *prog_name) puts("Options: (order IS relevant)"); puts(" --ipv4 / --ipv6 [Optional] Support IPv4 only or IPv4 & IPv6."); - puts(" IP PORT KEY [REQUIRED] A server to connect to (IP/Port) and its key."); + puts(" IP PORT KEY [REQUIRED] A node to connect to (IP/Port) and its key."); puts(" -f keyfile [Optional] Specify a keyfile to read from and write to."); } diff --git a/toxcore/network.h b/toxcore/network.h index aaf89f19..b0d306e4 100644 --- a/toxcore/network.h +++ b/toxcore/network.h @@ -149,7 +149,7 @@ typedef int sock_t; #define NET_PACKET_ONION_RECV_2 141 #define NET_PACKET_ONION_RECV_1 142 -/* Only used for bootstrap servers */ +/* Only used for bootstrap nodes */ #define BOOTSTRAP_INFO_PACKET_ID 240