Added --onion-address command line option to support incoming TOR connections

This commit is contained in:
SChernykh
2025-10-20 13:06:45 +02:00
parent d88790237d
commit cb9fc89b22
21 changed files with 493 additions and 125 deletions
+14
View File
@@ -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()) {