From 608330efefafdd7631829c0e3d918871ebef058b Mon Sep 17 00:00:00 2001 From: irungentoo Date: Fri, 17 Jan 2014 14:00:00 -0500 Subject: Onion servers are now DHT ready. --- other/DHT_bootstrap.c | 12 +++++++++++- other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'other') diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index af5fae01..c8895e15 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c @@ -102,9 +102,19 @@ int main(int argc, char *argv[]) ip_init(&ip, ipv6enabled); DHT *dht = new_DHT(new_net_crypto(new_networking(ip, PORT))); + Onion *onion = new_onion(dht); + Onion_Announce *onion_a = new_onion_announce(dht); + + if (!(onion && onion_a)) { + printf("Something failed to initialize.\n"); + exit(1); + } 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 */ + 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: "); uint32_t i; @@ -152,7 +162,7 @@ int main(int argc, char *argv[]) do_DHT(dht); if (is_timeout(last_LANdiscovery, is_waiting_for_dht_connection ? 5 : LAN_DISCOVERY_INTERVAL)) { - send_LANdiscovery(htons(PORT), dht->c); + send_LANdiscovery(htons(PORT), dht); last_LANdiscovery = unix_time(); } diff --git a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c index dc519448..e8e06b55 100644 --- a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c +++ b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c @@ -347,6 +347,13 @@ int main(int argc, char *argv[]) IP ip; ip_init(&ip, 0); DHT *dht = new_DHT(new_net_crypto(new_networking(ip, server_conf.port))); + Onion *onion = new_onion(dht); + Onion_Announce *onion_a = new_onion_announce(dht); + + if (!(onion && onion_a)) { + printf("Something failed to initialize.\n"); + exit(1); + } /* Read the config file */ printf("PID file: %s\n", server_conf.pid_file); printf("Key file: %s\n", server_conf.keys_file); @@ -367,6 +374,10 @@ int main(int argc, char *argv[]) manage_keys(dht, server_conf.keys_file); errno = tmperr; + /* We want our DHT public key to be the same as our internal one since this is a bootstrap server */ + 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); + /* Public key */ int i; printf("\nPublic Key: "); -- cgit v1.2.3