aboutsummaryrefslogtreecommitdiff
path: root/src/i2p.h
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2022-06-08 15:27:11 +0200
committerVasil Dimov <vd@FreeBSD.org>2022-08-11 17:51:18 +0200
commit2b781ad66e34000037f589c71366c203255ed058 (patch)
treeb32f162f1f1338797331c4385f3831db824f9ecd /src/i2p.h
parentc012875b9ded0a5183602f002738ca823d559518 (diff)
downloadbitcoin-2b781ad66e34000037f589c71366c203255ed058.tar.xz
i2p: add support for creating transient sessions
Instead of providing our destination (private key) to the I2P proxy when creating the session, ask it to generate one for us and do not save it on disk.
Diffstat (limited to 'src/i2p.h')
-rw-r--r--src/i2p.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/i2p.h b/src/i2p.h
index eb0a10103d..ebbcb437da 100644
--- a/src/i2p.h
+++ b/src/i2p.h
@@ -71,6 +71,19 @@ public:
CThreadInterrupt* interrupt);
/**
+ * Construct a transient session which will generate its own I2P private key
+ * rather than read the one from disk (it will not be saved on disk either and
+ * will be lost once this object is destroyed). This will not initiate any IO,
+ * the session will be lazily created later when first used.
+ * @param[in] control_host Location of the SAM proxy.
+ * @param[in,out] interrupt If this is signaled then all operations are canceled as soon as
+ * possible and executing methods throw an exception. Notice: only a pointer to the
+ * `CThreadInterrupt` object is saved, so it must not be destroyed earlier than this
+ * `Session` object.
+ */
+ Session(const CService& control_host, CThreadInterrupt* interrupt);
+
+ /**
* Destroy the session, closing the internally used sockets. The sockets that have been
* returned by `Accept()` or `Connect()` will not be closed, but they will be closed by
* the SAM proxy because the session is destroyed. So they will return an error next time
@@ -262,6 +275,12 @@ private:
* SAM session id.
*/
std::string m_session_id GUARDED_BY(m_mutex);
+
+ /**
+ * Whether this is a transient session (the I2P private key will not be
+ * read or written to disk).
+ */
+ const bool m_transient;
};
} // namespace sam