aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2020-12-04 18:03:05 +0100
committerVasil Dimov <vd@FreeBSD.org>2021-03-01 18:19:46 +0100
commit76c35c60f338937071bcfad4211ef7254d3830ec (patch)
treea4ab3dfbbb2f34ae520e000b8f04af36de9414c6 /src/net.h
parentc22daa2ecff1acd25426cd46f98f2587d1d324c3 (diff)
downloadbitcoin-76c35c60f338937071bcfad4211ef7254d3830ec.tar.xz
init: introduce I2P connectivity options
Introduce two new options to reach the I2P network: * `-i2psam=<ip:port>` point to the I2P SAM proxy. If this is set then the I2P network is considered reachable and we can make outgoing connections to I2P peers via that proxy. We listen for and accept incoming connections from I2P peers if the below is set in addition to `-i2psam=<ip:port>` * `-i2pacceptincoming` if this is set together with `-i2psam=<ip:port>` then we accept incoming I2P connections via the I2P SAM proxy.
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index be38441008..ab3111b0a2 100644
--- a/src/net.h
+++ b/src/net.h
@@ -14,6 +14,7 @@
#include <compat.h>
#include <crypto/siphash.h>
#include <hash.h>
+#include <i2p.h>
#include <net_permissions.h>
#include <netaddress.h>
#include <optional.h>
@@ -831,6 +832,7 @@ public:
std::vector<std::string> m_specified_outgoing;
std::vector<std::string> m_added_nodes;
std::vector<bool> m_asmap;
+ bool m_i2p_accept_incoming;
};
void Init(const Options& connOptions) {
@@ -1221,8 +1223,20 @@ private:
Mutex mutexMsgProc;
std::atomic<bool> flagInterruptMsgProc{false};
+ /**
+ * This is signaled when network activity should cease.
+ * A pointer to it is saved in `m_i2p_sam_session`, so make sure that
+ * the lifetime of `interruptNet` is not shorter than
+ * the lifetime of `m_i2p_sam_session`.
+ */
CThreadInterrupt interruptNet;
+ /**
+ * I2P SAM session.
+ * Used to accept incoming and make outgoing I2P connections.
+ */
+ std::unique_ptr<i2p::sam::Session> m_i2p_sam_session;
+
std::thread threadDNSAddressSeed;
std::thread threadSocketHandler;
std::thread threadOpenAddedConnections;