aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/net.h b/src/net.h
index 3f4c8e38ec..a38310938b 100644
--- a/src/net.h
+++ b/src/net.h
@@ -31,6 +31,7 @@
#include <condition_variable>
#include <cstdint>
#include <deque>
+#include <functional>
#include <map>
#include <memory>
#include <optional>
@@ -182,7 +183,15 @@ enum class ConnectionType {
/** Convert ConnectionType enum to a string value */
std::string ConnectionTypeAsString(ConnectionType conn_type);
+
+/**
+ * Look up IP addresses from all interfaces on the machine and add them to the
+ * list of local addresses to self-advertise.
+ * The loopback interface is skipped and only the first address from each
+ * interface is used.
+ */
void Discover();
+
uint16_t GetListenPort();
enum
@@ -1272,7 +1281,17 @@ private:
};
/** Dump binary message to file, with timestamp */
-void CaptureMessage(const CAddress& addr, const std::string& msg_type, const Span<const unsigned char>& data, bool is_incoming);
+void CaptureMessageToFile(const CAddress& addr,
+ const std::string& msg_type,
+ Span<const unsigned char> data,
+ bool is_incoming);
+
+/** Defaults to `CaptureMessageToFile()`, but can be overridden by unit tests. */
+extern std::function<void(const CAddress& addr,
+ const std::string& msg_type,
+ Span<const unsigned char> data,
+ bool is_incoming)>
+ CaptureMessage;
struct NodeEvictionCandidate
{
@@ -1316,6 +1335,8 @@ struct NodeEvictionCandidate
*
* - I2P peers
*
+ * - CJDNS peers
+ *
* This helps protect these privacy network peers, which tend to be otherwise
* disadvantaged under our eviction criteria for their higher min ping times
* relative to IPv4/IPv6 peers, and favorise the diversity of peer connections.