summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGDR! <gdr@gdr.name>2018-03-24 10:01:12 +0100
committerGDR! <gdr@gdr.name>2018-03-24 10:01:12 +0100
commit3b26f4eac390008113ca0d5c0978ed7da19dfa34 (patch)
tree8794311660e8e500eb492e28c9445a18f92f6d95
parentf8f68e77d95bc81060c311cf2b92e883db3bfa79 (diff)
Print DHT key in debug log
-rw-r--r--main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/main.c b/main.c
index 2581a20..809baec 100644
--- a/main.c
+++ b/main.c
@@ -1526,11 +1526,18 @@ int main(int argc, char *argv[])
1526 1526
1527 if(client_mode) 1527 if(client_mode)
1528 { 1528 {
1529 uint8_t dht_key[TOX_PUBLIC_KEY_SIZE];
1530 char_t readable_dht_key[2 * TOX_PUBLIC_KEY_SIZE + 1];
1531
1529 tox_self_get_address(tox, tox_id); 1532 tox_self_get_address(tox, tox_id);
1530 id_to_string(tox_printable_id, tox_id); 1533 id_to_string(tox_printable_id, tox_id);
1531 tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0'; 1534 tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0';
1532 log_printf(L_DEBUG, "Generated Tox ID: %s\n", tox_printable_id); 1535 log_printf(L_DEBUG, "Generated Tox ID: %s\n", tox_printable_id);
1533 1536
1537 tox_self_get_dht_id(tox, dht_key);
1538 to_hex(readable_dht_key, dht_key, TOX_PUBLIC_KEY_SIZE);
1539 log_printf(L_DEBUG, "DHT key: %s\n", readable_dht_key);
1540
1534 if(!remote_tox_id) 1541 if(!remote_tox_id)
1535 { 1542 {
1536 log_printf(L_ERROR, "Tox id is required in client mode. Use -i 58435984ABCDEF475...\n"); 1543 log_printf(L_ERROR, "Tox id is required in client mode. Use -i 58435984ABCDEF475...\n");
@@ -1540,6 +1547,9 @@ int main(int argc, char *argv[])
1540 } 1547 }
1541 else 1548 else
1542 { 1549 {
1550 uint8_t dht_key[TOX_PUBLIC_KEY_SIZE];
1551 char_t readable_dht_key[2 * TOX_PUBLIC_KEY_SIZE + 1];
1552
1543 write_save(tox); 1553 write_save(tox);
1544 1554
1545 if(!use_shared_secret) 1555 if(!use_shared_secret)
@@ -1553,6 +1563,10 @@ int main(int argc, char *argv[])
1553 tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0'; 1563 tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0';
1554 log_printf(L_INFO, "Using Tox ID: %s\n", tox_printable_id); 1564 log_printf(L_INFO, "Using Tox ID: %s\n", tox_printable_id);
1555 1565
1566 tox_self_get_dht_id(tox, dht_key);
1567 to_hex(readable_dht_key, dht_key, TOX_PUBLIC_KEY_SIZE);
1568 log_printf(L_DEBUG, "DHT key: %s\n", readable_dht_key);
1569
1556 tox_callback_friend_request(tox, accept_friend_request); 1570 tox_callback_friend_request(tox, accept_friend_request);
1557 do_server_loop(); 1571 do_server_loop();
1558 clear_rules(); 1572 clear_rules();