From ec45646de9e62b3d42c85716bfeb06d8f2b507dc Mon Sep 17 00:00:00 2001 From: Gleb Naumenko Date: Tue, 24 Dec 2019 13:18:44 -0500 Subject: Integrate ASN bucketing in Addrman and add tests Instead of using /16 netgroups to bucket nodes in Addrman for connection diversification, ASN, which better represents an actor in terms of network-layer infrastructure, is used. For testing, asmap.raw is used. It represents a minimal asmap needed for testing purposes. --- src/net.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 9cd3b769ec..fe520cea73 100644 --- a/src/net.h +++ b/src/net.h @@ -153,6 +153,7 @@ public: bool m_use_addrman_outgoing = true; std::vector m_specified_outgoing; std::vector m_added_nodes; + std::vector m_asmap; }; void Init(const Options& connOptions) { @@ -330,6 +331,8 @@ public: */ int64_t PoissonNextSendInbound(int64_t now, int average_interval_seconds); + void SetAsmap(std::vector asmap) { addrman.m_asmap = asmap; } + private: struct ListenSocket { public: -- cgit v1.2.3 From e4658aa8eaf1629dd5af8cf7b9717a8e72028251 Mon Sep 17 00:00:00 2001 From: Gleb Naumenko Date: Tue, 24 Dec 2019 13:26:46 -0500 Subject: Return mapped AS in RPC call getpeerinfo If ASN bucketing is used, return a corresponding AS used in bucketing for a given peer. --- src/net.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index fe520cea73..3180a8c897 100644 --- a/src/net.h +++ b/src/net.h @@ -606,6 +606,7 @@ public: CAddress addr; // Bind address of our side of the connection CAddress addrBind; + uint32_t m_mapped_as; }; @@ -982,7 +983,7 @@ public: void CloseSocketDisconnect(); - void copyStats(CNodeStats &stats); + void copyStats(CNodeStats &stats, std::vector &m_asmap); ServiceFlags GetLocalServices() const { -- cgit v1.2.3