Added --onion-address command line option to support incoming TOR connections
This commit is contained in:
@@ -268,6 +268,11 @@ Params::Params(int argc, char* const argv[])
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--onion-address") == 0) && (i + 1 < argc)) {
|
||||
m_onionAddress = argv[++i];
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
// Wait to avoid log messages overlapping with printf() calls and making a mess on screen
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
@@ -278,6 +283,15 @@ Params::Params(int argc, char* const argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_onionAddress.empty()) {
|
||||
m_onionPubkey = from_onion_v3(m_onionAddress);
|
||||
|
||||
if (m_onionPubkey.empty()) {
|
||||
LOGERR(1, "Failed to parse \"" << m_onionAddress << '"');
|
||||
throw std::exception();
|
||||
}
|
||||
}
|
||||
|
||||
auto invalid_host = [](const Host& h)
|
||||
{
|
||||
if (!h.valid()) {
|
||||
|
||||
Reference in New Issue
Block a user