Skip to content
Snippets Groups Projects
Select Git revision
  • proxy
  • master default
  • windows_ci_static
  • c_link
  • cpack
  • windows_ci
  • cert_pk_id
  • proxy_push_result
  • cnode_put_id
  • update-windows-build
  • resubscribe_on_token_change
  • actions
  • client_mode
  • llhttp
  • search_node_add
  • crypto_aes_gcm_argon2
  • ios_notifications
  • log_fmt
  • v2asio
  • fix-msvc
  • v3.4.0
  • v3.3.1
  • v3.3.1rc1
  • v3.3.1rc2
  • v3.3.0
  • v3.2.0
  • v3.1.11
  • v3.1.10
  • v3.1.9
  • v3.1.8.2
  • v3.1.8.1
  • v3.1.8
  • v3.1.7
  • v3.1.6
  • v3.1.5
  • v3.1.4
  • v3.1.3
  • v3.1.2
  • v3.1
  • v3.0.1
40 results

autogen.sh

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    dhtnode.cpp 21.97 KiB
    /*
     *  Copyright (C) 2014-2017 Savoir-faire Linux Inc.
     *
     *  Authors: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
     *           Simon Désaulniers <simon.desaulniers@savoirfairelinux.com>
     *           Sébastien Blin <sebastien.blin@savoirfairelinux.com>
     *
     *  This program is free software; you can redistribute it and/or modify
     *  it under the terms of the GNU General Public License as published by
     *  the Free Software Foundation; either version 3 of the License, or
     *  (at your option) any later version.
     *
     *  This program is distributed in the hope that it will be useful,
     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *  GNU General Public License for more details.
     *
     *  You should have received a copy of the GNU General Public License
     *  along with this program. If not, see <https://www.gnu.org/licenses/>.
     */
    
    #include "tools_common.h"
    extern "C" {
    #include <gnutls/gnutls.h>
    }
    
    #include <set>
    #include <thread> // std::this_thread::sleep_for
    
    using namespace dht;
    
    void print_usage() {
        std::cout << "Usage: dhtnode [-v [-l logfile]] [-i] [-d] [-n network_id] [-p local_port] [-b bootstrap_host[:port]] [--proxyserver local_port]" << std::endl << std::endl;
        std::cout << "dhtnode, a simple OpenDHT command line node runner." << std::endl;
        std::cout << "Report bugs to: https://opendht.net" << std::endl;
    }
    
    void print_id_req() {
        std::cout << "An identity is required to perform this operation (run with -i)" << std::endl;
    }
    
    void print_node_info(const std::shared_ptr<DhtRunner>& dht, const dht_params& params) {
        std::cout << "OpenDht node " << dht->getNodeId() << " running on port " <<  dht->getBoundPort() << std::endl;
        if (params.generate_identity)
            std::cout << "Public key ID " << dht->getId() << std::endl;
    }
    
    void print_help() {
        std::cout << "OpenDht command line interface (CLI)" << std::endl;
        std::cout << "Possible commands:" << std::endl
                  << "  h, help    Print this help message." << std::endl
                  << "  x, quit    Quit the program." << std::endl
                  << "  log        Start/stop printing DHT logs." << std::endl;
    
        std::cout << std::endl << "Node information:" << std::endl
                  << "  ll         Print basic information and stats about the current node." << std::endl
                  << "  ls [key]   Print basic information about current search(es)." << std::endl
                  << "  ld [key]   Print basic information about currenty stored values on this node (or key)." << std::endl
                  << "  lr         Print the full current routing table of this node." << std::endl;
    
    #if OPENDHT_PROXY_SERVER
        std::cout << std::endl << "Operations with the proxy:" << std::endl
    #if OPENDHT_PUSH_NOTIFICATIONS
                  << "  pst [port] <pushServer> Start the proxy interface on port." << std::endl
    #else
                  << "  pst [port]              Start the proxy interface on port." << std::endl
    #endif // OPENDHT_PUSH_NOTIFICATIONS
                  << "  psp [port]              Stop the proxy interface on port." << std::endl;
    #endif //OPENDHT_PROXY_SERVER