mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 12:28:42 +00:00
tools: use bootstrap split/default port from dht
This commit is contained in:
1 parent
99857e25cc
commit
47ba0415ca
4 files changed
+13
-20
No files matched your search
+2
-2
@@ -64,8 +64,8 @@ main(int argc, char **argv)
|
||||
auto dhtConf = getDhtConfig(params);
|
||||
dht.run(params.port, dhtConf.first, std::move(dhtConf.second));
|
||||
|
||||
if (not params.bootstrap.first.empty())
|
||||
dht.bootstrap(params.bootstrap.first.c_str(), params.bootstrap.second.c_str());
|
||||
if (not params.bootstrap.empty())
|
||||
dht.bootstrap(params.bootstrap);
|
||||
|
||||
print_node_info(dht.getNodeInfo(), params);
|
||||
std::cout << " type 'c {hash}' to join a channel" << std::endl << std::endl;
|
||||
|
||||
+7
-11
@@ -191,14 +191,10 @@ void cmd_loop(std::shared_ptr<DhtRunner>& node, dht_params& params
|
||||
continue;
|
||||
} else if (op == "b") {
|
||||
iss >> idstr;
|
||||
try {
|
||||
auto addr = splitPort(idstr);
|
||||
if (not addr.first.empty() and addr.second.empty())
|
||||
addr.second = std::to_string(dht::net::DHT_DEFAULT_PORT);
|
||||
node->bootstrap(addr.first.c_str(), addr.second.c_str());
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
if (not idstr.empty())
|
||||
node->bootstrap(idstr);
|
||||
else
|
||||
std::cerr << "No service provided. Syntax: b hostname:port" << std::endl;
|
||||
continue;
|
||||
} else if (op == "log") {
|
||||
iss >> idstr;
|
||||
@@ -538,9 +534,9 @@ main(int argc, char **argv)
|
||||
auto dhtConf = getDhtConfig(params);
|
||||
node->run(params.port, dhtConf.first, std::move(dhtConf.second));
|
||||
|
||||
if (not params.bootstrap.first.empty()) {
|
||||
std::cout << "Bootstrap: " << params.bootstrap.first << ":" << params.bootstrap.second << std::endl;
|
||||
node->bootstrap(params.bootstrap.first.c_str(), params.bootstrap.second.c_str());
|
||||
if (not params.bootstrap.empty()) {
|
||||
std::cout << "Bootstrap: " << params.bootstrap << std::endl;
|
||||
node->bootstrap(params.bootstrap);
|
||||
}
|
||||
|
||||
#ifdef OPENDHT_PROXY_SERVER
|
||||
|
||||
@@ -91,8 +91,8 @@ main(int argc, char **argv)
|
||||
auto dhtConf = getDhtConfig(params);
|
||||
dht.run(params.port, dhtConf.first, std::move(dhtConf.second));
|
||||
|
||||
if (not params.bootstrap.first.empty())
|
||||
dht.bootstrap(params.bootstrap.first.c_str(), params.bootstrap.second.c_str());
|
||||
if (not params.bootstrap.empty())
|
||||
dht.bootstrap(params.bootstrap);
|
||||
|
||||
print_node_info(dht.getNodeInfo(), params);
|
||||
std::cout << "Scanning network..." << std::endl;
|
||||
|
||||
@@ -124,7 +124,7 @@ struct dht_params {
|
||||
bool log {false};
|
||||
bool syslog {false};
|
||||
std::string logfile {};
|
||||
std::pair<std::string, std::string> bootstrap {};
|
||||
std::string bootstrap {};
|
||||
dht::NetId network {0};
|
||||
in_port_t port {0};
|
||||
in_port_t proxyserver {0};
|
||||
@@ -289,10 +289,7 @@ parseArgs(int argc, char **argv) {
|
||||
params.public_stable = true;
|
||||
break;
|
||||
case 'b':
|
||||
params.bootstrap = dht::splitPort((optarg[0] == '=') ? optarg+1 : optarg);
|
||||
if (not params.bootstrap.first.empty() and params.bootstrap.second.empty()) {
|
||||
params.bootstrap.second = std::to_string(dht::net::DHT_DEFAULT_PORT);
|
||||
}
|
||||
params.bootstrap = (optarg[0] == '=') ? optarg+1 : optarg;
|
||||
break;
|
||||
case 'V':
|
||||
params.version = true;
|
||||
|
||||
Reference in new issue
Block a user