aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-03-04 21:20:33 +0200
committerRiccardo Spagni <ric@spagni.net>2019-03-04 21:20:34 +0200
commit4466f4504e8bc41d353a6becce0526df8272bc1d (patch)
treef22a1a5bf61c24b596f8f070017403dc639c34a6 /src/p2p/net_node.cpp
parentMerge pull request #5084 (diff)
parenti2p: initial support (diff)
downloadmonero-4466f4504e8bc41d353a6becce0526df8272bc1d.tar.xz
Merge pull request #5091
123fc2a2 i2p: initial support (Jethro Grassie)
Diffstat (limited to 'src/p2p/net_node.cpp')
-rw-r--r--src/p2p/net_node.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp
index 8639fdb3b..2f0678913 100644
--- a/src/p2p/net_node.cpp
+++ b/src/p2p/net_node.cpp
@@ -46,13 +46,14 @@
#include "net/socks.h"
#include "net/parse.h"
#include "net/tor_address.h"
+#include "net/i2p_address.h"
#include "p2p/p2p_protocol_defs.h"
#include "string_tools.h"
namespace
{
constexpr const boost::chrono::milliseconds future_poll_interval{500};
- constexpr const std::chrono::seconds tor_connect_timeout{P2P_DEFAULT_TOR_CONNECT_TIMEOUT};
+ constexpr const std::chrono::seconds socks_connect_timeout{P2P_DEFAULT_SOCKS_CONNECT_TIMEOUT};
std::int64_t get_max_connections(const boost::iterator_range<boost::string_ref::const_iterator> value) noexcept
{
@@ -90,6 +91,9 @@ namespace
case net::tor_address::get_type_id():
set = client->set_connect_command(remote.as<net::tor_address>());
break;
+ case net::i2p_address::get_type_id():
+ set = client->set_connect_command(remote.as<net::i2p_address>());
+ break;
default:
MERROR("Unsupported network address in socks_connect");
return false;
@@ -177,6 +181,9 @@ namespace nodetool
case epee::net_utils::zone::tor:
proxies.back().zone = epee::net_utils::zone::tor;
break;
+ case epee::net_utils::zone::i2p:
+ proxies.back().zone = epee::net_utils::zone::i2p;
+ break;
default:
MERROR("Invalid network for --" << arg_proxy.name);
return boost::none;
@@ -235,6 +242,10 @@ namespace nodetool
inbounds.back().our_address = std::move(*our_address);
inbounds.back().default_remote = net::tor_address::unknown();
break;
+ case net::i2p_address::get_type_id():
+ inbounds.back().our_address = std::move(*our_address);
+ inbounds.back().default_remote = net::i2p_address::unknown();
+ break;
default:
MERROR("Invalid inbound address (" << address << ") for --" << arg_anonymous_inbound.name << ": " << (our_address ? "invalid type" : our_address.error().message()));
return boost::none;
@@ -308,7 +319,7 @@ namespace nodetool
const auto start = std::chrono::steady_clock::now();
while (socks_result.wait_for(future_poll_interval) == boost::future_status::timeout)
{
- if (tor_connect_timeout < std::chrono::steady_clock::now() - start)
+ if (socks_connect_timeout < std::chrono::steady_clock::now() - start)
{
MERROR("Timeout on socks connect (" << proxy << " to " << remote.str() << ")");
return boost::none;