summaryrefslogtreecommitdiff
path: root/other
diff options
context:
space:
mode:
Diffstat (limited to 'other')
-rw-r--r--other/DHT_bootstrap.c12
-rw-r--r--other/DHTnodes (renamed from other/DHTservers)2
-rw-r--r--other/Makefile.inc2
-rw-r--r--other/bootstrap_daemon/Makefile.inc (renamed from other/bootstrap_serverdaemon/Makefile.inc)8
-rw-r--r--other/bootstrap_daemon/README.md (renamed from other/bootstrap_serverdaemon/README.md)0
-rw-r--r--other/bootstrap_daemon/conf (renamed from other/bootstrap_serverdaemon/conf)15
-rw-r--r--other/bootstrap_daemon/tox_bootstrap_daemon.c (renamed from other/bootstrap_serverdaemon/tox_bootstrap_daemon.c)56
-rw-r--r--other/bootstrap_daemon/tox_bootstrap_daemon.sh (renamed from other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh)0
-rw-r--r--other/bootstrap_node_packets.c (renamed from other/bootstrap_server_packets.c)6
9 files changed, 51 insertions, 50 deletions
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 @@
1 1
2/* DHT boostrap 2/* DHT boostrap
3 * 3 *
4 * A simple DHT boostrap server for tox. 4 * A simple DHT boostrap node for tox.
5 * 5 *
6 * Copyright (C) 2013 Tox project All Rights Reserved. 6 * Copyright (C) 2013 Tox project All Rights Reserved.
7 * 7 *
@@ -33,8 +33,8 @@
33 33
34#include "../testing/misc_tools.c" 34#include "../testing/misc_tools.c"
35 35
36#ifdef DHT_SERVER_EXTRA_PACKETS 36#ifdef DHT_NODE_EXTRA_PACKETS
37#include "./bootstrap_server_packets.c" 37#include "./bootstrap_node_packets.c"
38 38
39#define DHT_VERSION_NUMBER 1 39#define DHT_VERSION_NUMBER 1
40#define DHT_MOTD "This is a test motd" 40#define DHT_MOTD "This is a test motd"
@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
111 Onion *onion = new_onion(dht); 111 Onion *onion = new_onion(dht);
112 Onion_Announce *onion_a = new_onion_announce(dht); 112 Onion_Announce *onion_a = new_onion_announce(dht);
113 113
114#ifdef DHT_SERVER_EXTRA_PACKETS 114#ifdef DHT_NODE_EXTRA_PACKETS
115 bootstrap_set_callbacks(dht->net, DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD)); 115 bootstrap_set_callbacks(dht->net, DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD));
116#endif 116#endif
117 117
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
123 perror("Initialization"); 123 perror("Initialization");
124 124
125 manage_keys(dht); 125 manage_keys(dht);
126 /* We want our DHT public key to be the same as our internal one since this is a bootstrap server */ 126 /* We want our DHT public key to be the same as our internal one since this is a bootstrap node */
127 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); 127 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES);
128 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); 128 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES);
129 printf("Public key: "); 129 printf("Public key: ");
@@ -166,7 +166,7 @@ int main(int argc, char *argv[])
166 166
167 while (1) { 167 while (1) {
168 if (is_waiting_for_dht_connection && DHT_isconnected(dht)) { 168 if (is_waiting_for_dht_connection && DHT_isconnected(dht)) {
169 printf("Connected to other bootstrap server successfully.\n"); 169 printf("Connected to other bootstrap node successfully.\n");
170 is_waiting_for_dht_connection = 0; 170 is_waiting_for_dht_connection = 0;
171 } 171 }
172 172
diff --git a/other/DHTservers b/other/DHTnodes
index 48e1d115..35509931 100644
--- a/other/DHTservers
+++ b/other/DHTnodes
@@ -1,3 +1,3 @@
1As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out. 1As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out.
2 2
3For a current DHT server list please visit http://wiki.tox.im/Servers 3For 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) \
15 $(NACL_LIBS) \ 15 $(NACL_LIBS) \
16 $(WINSOCK2_LIBS) 16 $(WINSOCK2_LIBS)
17 17
18EXTRA_DIST += $(top_srcdir)/other/DHTservers \ 18EXTRA_DIST += $(top_srcdir)/other/DHTnodes \
19 $(top_srcdir)/other/tox.png 19 $(top_srcdir)/other/tox.png
diff --git a/other/bootstrap_serverdaemon/Makefile.inc b/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
3noinst_PROGRAMS += tox_bootstrap_daemon 3noinst_PROGRAMS += tox_bootstrap_daemon
4 4
5tox_bootstrap_daemon_SOURCES = \ 5tox_bootstrap_daemon_SOURCES = \
6 ../other/bootstrap_serverdaemon/tox_bootstrap_daemon.c 6 ../other/bootstrap_daemon/tox_bootstrap_daemon.c
7 7
8tox_bootstrap_daemon_CFLAGS = \ 8tox_bootstrap_daemon_CFLAGS = \
9 -I$(top_srcdir)/other/bootstrap_serverdaemon \ 9 -I$(top_srcdir)/other/bootstrap_daemon \
10 $(LIBSODIUM_CFLAGS) \ 10 $(LIBSODIUM_CFLAGS) \
11 $(NACL_CFLAGS) \ 11 $(NACL_CFLAGS) \
12 $(LIBCONFIG_CFLAGS) 12 $(LIBCONFIG_CFLAGS)
@@ -22,6 +22,6 @@ tox_bootstrap_daemon_LDADD = \
22endif 22endif
23 23
24EXTRA_DIST += \ 24EXTRA_DIST += \
25 $(top_srcdir)/other/bootstrap_serverdaemon/conf \ 25 $(top_srcdir)/other/bootstrap_daemon/conf \
26 $(top_srcdir)/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh 26 $(top_srcdir)/other/bootstrap_daemon/tox_bootstrap_daemon.sh
27 \ No newline at end of file 27 \ No newline at end of file
diff --git a/other/bootstrap_serverdaemon/README.md b/other/bootstrap_daemon/README.md
index 53a25cdb..53a25cdb 100644
--- a/other/bootstrap_serverdaemon/README.md
+++ b/other/bootstrap_daemon/README.md
diff --git a/other/bootstrap_serverdaemon/conf b/other/bootstrap_daemon/conf
index 8451d9a0..28e638c1 100644
--- a/other/bootstrap_serverdaemon/conf
+++ b/other/bootstrap_daemon/conf
@@ -1,4 +1,4 @@
1// ProjectTox dht bootstrap server daemon configuration file. 1// ProjectTox dht bootstrap node daemon configuration file.
2 2
3// Listening port. 3// Listening port.
4port = 33445 4port = 33445
@@ -20,20 +20,21 @@ enable_ipv6 = false
20// Automatically bootstrap with nodes on local area network. 20// Automatically bootstrap with nodes on local area network.
21enable_lan_discovery = true 21enable_lan_discovery = true
22 22
23// Any number of servers the daemon will bootstrap itself from. 23// Any number of nodes the daemon will bootstrap itself from.
24// Remember to replace the provided example with your own server list. 24// Remember to replace the provided example with your own node list.
25// You may leave the list empty or remove "bootstrap_servers" complitely, 25// There is a maintained list of bootstrap nodes on Tox's wiki, if you need it.
26// You may leave the list empty or remove "bootstrap_nodes" complitely,
26// in both cases this will be interpreted as if you don't want to bootstrap 27// in both cases this will be interpreted as if you don't want to bootstrap
27// from anyone. 28// from anyone.
28bootstrap_servers = ( 29bootstrap_nodes = (
29 { // Server 1 30 { // Node 1
30 // Any ipv4 or ipv6, depending if `enable_ipv6` is set or not, and also 31 // Any ipv4 or ipv6, depending if `enable_ipv6` is set or not, and also
31 // any US-ASCII domain name. 32 // any US-ASCII domain name.
32 address = "198.46.136.167" 33 address = "198.46.136.167"
33 port = 33445 34 port = 33445
34 public_key = "728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854" 35 public_key = "728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854"
35 }, 36 },
36 { // Server 2 37 { // Node 2
37 address = "example.org" 38 address = "example.org"
38 port = 33445 39 port = 33445
39 public_key = "8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858" 40 public_key = "8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858"
diff --git a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c b/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 @@
1/* tox_bootstrap_daemon.c 1/* tox_bootstrap_daemon.c
2 * 2 *
3 * Tox DHT bootstrap server daemon. 3 * Tox DHT bootstrap node daemon.
4 * 4 *
5 * Copyright (C) 2014 Tox project All Rights Reserved. 5 * Copyright (C) 2014 Tox project All Rights Reserved.
6 * 6 *
@@ -92,7 +92,7 @@ int manage_keys(DHT *dht, char *keys_file_path)
92 92
93 fclose(keys_file); 93 fclose(keys_file);
94 94
95 // We want our DHT public key to be the same as our internal one since this is a bootstrap server 95 // We want our DHT public key to be the same as our internal one since this is a bootstrap node
96 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); 96 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES);
97 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); 97 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES);
98 98
@@ -184,14 +184,14 @@ int get_general_config(char *cfg_file_path, char **pid_file_path, char **keys_fi
184 return 1; 184 return 1;
185} 185}
186 186
187// Bootstraps servers listed in the config file 187// Bootstraps nodes listed in the config file
188// 188//
189// returns 1 on success, some or no bootstrap servers were added 189// returns 1 on success, some or no bootstrap nodes were added
190// 0 on failure, a error accured while parsing config file 190// 0 on failure, a error accured while parsing config file
191 191
192int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6) 192int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
193{ 193{
194 const char *NAME_BOOTSTRAP_SERVERS = "bootstrap_servers"; 194 const char *NAME_BOOTSTRAP_NODES = "bootstrap_nodes";
195 195
196 const char *NAME_PUBLIC_KEY = "public_key"; 196 const char *NAME_PUBLIC_KEY = "public_key";
197 const char *NAME_PORT = "port"; 197 const char *NAME_PORT = "port";
@@ -207,16 +207,16 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
207 return 0; 207 return 0;
208 } 208 }
209 209
210 config_setting_t *server_list = config_lookup(&cfg, NAME_BOOTSTRAP_SERVERS); 210 config_setting_t *node_list = config_lookup(&cfg, NAME_BOOTSTRAP_NODES);
211 211
212 if (server_list == NULL) { 212 if (node_list == NULL) {
213 syslog(LOG_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", NAME_BOOTSTRAP_SERVERS); 213 syslog(LOG_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", NAME_BOOTSTRAP_NODES);
214 config_destroy(&cfg); 214 config_destroy(&cfg);
215 return 1; 215 return 1;
216 } 216 }
217 217
218 if (config_setting_length(server_list) == 0) { 218 if (config_setting_length(node_list) == 0) {
219 syslog(LOG_WARNING, "No bootstrap servers found. Skipping bootstrapping.\n"); 219 syslog(LOG_WARNING, "No bootstrap nodes found. Skipping bootstrapping.\n");
220 config_destroy(&cfg); 220 config_destroy(&cfg);
221 return 1; 221 return 1;
222 } 222 }
@@ -225,45 +225,45 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
225 const char *bs_address; 225 const char *bs_address;
226 const char *bs_public_key; 226 const char *bs_public_key;
227 227
228 config_setting_t *server; 228 config_setting_t *node;
229 229
230 int i = 0; 230 int i = 0;
231 231
232 while (config_setting_length(server_list)) { 232 while (config_setting_length(node_list)) {
233 233
234 server = config_setting_get_elem(server_list, 0); 234 node = config_setting_get_elem(node_list, 0);
235 235
236 if (server == NULL) { 236 if (node == NULL) {
237 config_destroy(&cfg); 237 config_destroy(&cfg);
238 return 0; 238 return 0;
239 } 239 }
240 240
241 // Check that all settings are present 241 // Check that all settings are present
242 if (config_setting_lookup_string(server, NAME_PUBLIC_KEY, &bs_public_key) == CONFIG_FALSE) { 242 if (config_setting_lookup_string(node, NAME_PUBLIC_KEY, &bs_public_key) == CONFIG_FALSE) {
243 syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_PUBLIC_KEY); 243 syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_PUBLIC_KEY);
244 goto next; 244 goto next;
245 } 245 }
246 246
247 if (config_setting_lookup_int(server, NAME_PORT, &bs_port) == CONFIG_FALSE) { 247 if (config_setting_lookup_int(node, NAME_PORT, &bs_port) == CONFIG_FALSE) {
248 syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_PORT); 248 syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_PORT);
249 goto next; 249 goto next;
250 } 250 }
251 251
252 if (config_setting_lookup_string(server, NAME_ADDRESS, &bs_address) == CONFIG_FALSE) { 252 if (config_setting_lookup_string(node, NAME_ADDRESS, &bs_address) == CONFIG_FALSE) {
253 syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_ADDRESS); 253 syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_ADDRESS);
254 goto next; 254 goto next;
255 } 255 }
256 256
257 // Process settings 257 // Process settings
258 if (strlen(bs_public_key) != 64) { 258 if (strlen(bs_public_key) != 64) {
259 syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %s. Skipping the server.\n", i, NAME_PUBLIC_KEY, 259 syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n", i, NAME_PUBLIC_KEY,
260 bs_public_key); 260 bs_public_key);
261 goto next; 261 goto next;
262 } 262 }
263 263
264 // not (1 <= port <= 65535) 264 // not (1 <= port <= 65535)
265 if (bs_port < 1 || bs_port > 65535) { 265 if (bs_port < 1 || bs_port > 65535) {
266 syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %d. Skipping the server.\n", i, NAME_PORT, bs_port); 266 syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %d. Skipping the node.\n", i, NAME_PORT, bs_port);
267 goto next; 267 goto next;
268 } 268 }
269 269
@@ -273,17 +273,17 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
273 free(bs_public_key_bin); 273 free(bs_public_key_bin);
274 274
275 if (!address_resolved) { 275 if (!address_resolved) {
276 syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %s. Skipping the server.\n", i, NAME_ADDRESS, bs_address); 276 syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n", i, NAME_ADDRESS, bs_address);
277 goto next; 277 goto next;
278 } 278 }
279 279
280 syslog(LOG_DEBUG, "Successfully added bootstrap server #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key); 280 syslog(LOG_DEBUG, "Successfully added bootstrap node #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key);
281 281
282next: 282next:
283 // config_setting_lookup_string() allocates string inside and doesn't allow us to free it 283 // config_setting_lookup_string() allocates string inside and doesn't allow us to free it
284 // so in order to reuse `bs_public_key` and `bs_address` we have to remove the element 284 // so in order to reuse `bs_public_key` and `bs_address` we have to remove the element
285 // which will cause libconfig to free allocated strings 285 // which will cause libconfig to free allocated strings
286 config_setting_remove_elem(server_list, 0); 286 config_setting_remove_elem(node_list, 0);
287 i++; 287 i++;
288 } 288 }
289 289
@@ -378,9 +378,9 @@ int main(int argc, char *argv[])
378 } 378 }
379 379
380 if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) { 380 if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) {
381 syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n"); 381 syslog(LOG_DEBUG, "List of bootstrap nodes read successfully\n");
382 } else { 382 } else {
383 syslog(LOG_ERR, "Couldn't read list of bootstrap servers in %s. Exiting.\n", cfg_file_path); 383 syslog(LOG_ERR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path);
384 return 1; 384 return 1;
385 } 385 }
386 386
@@ -449,7 +449,7 @@ int main(int argc, char *argv[])
449 networking_poll(dht->net); 449 networking_poll(dht->net);
450 450
451 if (waiting_for_dht_connection && DHT_isconnected(dht)) { 451 if (waiting_for_dht_connection && DHT_isconnected(dht)) {
452 syslog(LOG_DEBUG, "Connected to other bootstrap server successfully.\n"); 452 syslog(LOG_DEBUG, "Connected to other bootstrap node successfully.\n");
453 waiting_for_dht_connection = 0; 453 waiting_for_dht_connection = 0;
454 } 454 }
455 455
diff --git a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh b/other/bootstrap_daemon/tox_bootstrap_daemon.sh
index 83d9a119..83d9a119 100644
--- a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh
+++ b/other/bootstrap_daemon/tox_bootstrap_daemon.sh
diff --git a/other/bootstrap_server_packets.c b/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 @@
1/* bootstrap_server_packets.c 1/* bootstrap_node_packets.c
2 * 2 *
3 * Special bootstrap server only packets. 3 * Special bootstrap node only packets.
4 * 4 *
5 * Include it in your bootstrap server and use: bootstrap_set_callbacks() to enable. 5 * Include it in your bootstrap node and use: bootstrap_set_callbacks() to enable.
6 * 6 *
7 * Copyright (C) 2013 Tox project All Rights Reserved. 7 * Copyright (C) 2013 Tox project All Rights Reserved.
8 * 8 *