Bitcoin Core 28.99.0
P2P Digital Currency
|
Netgroup manager. More...
#include <netgroup.h>
Public Member Functions | |
NetGroupManager (std::vector< bool > asmap) | |
uint256 | GetAsmapChecksum () const |
Get a checksum identifying the asmap being used. More... | |
std::vector< unsigned char > | GetGroup (const CNetAddr &address) const |
Get the canonical identifier of the network group for address. More... | |
uint32_t | GetMappedAS (const CNetAddr &address) const |
Get the autonomous system on the BGP path to address. More... | |
void | ASMapHealthCheck (const std::vector< CNetAddr > &clearnet_addrs) const |
Analyze and log current health of ASMap based buckets. More... | |
bool | UsingASMap () const |
Indicates whether ASMap is being used for clearnet bucketing. More... | |
Private Attributes | |
const std::vector< bool > | m_asmap |
Compressed IP->ASN mapping, loaded from a file when a node starts. More... | |
Netgroup manager.
Definition at line 16 of file netgroup.h.
|
inlineexplicit |
Definition at line 18 of file netgroup.h.
void NetGroupManager::ASMapHealthCheck | ( | const std::vector< CNetAddr > & | clearnet_addrs | ) | const |
Analyze and log current health of ASMap based buckets.
Definition at line 114 of file netgroup.cpp.
uint256 NetGroupManager::GetAsmapChecksum | ( | ) | const |
Get a checksum identifying the asmap being used.
Definition at line 11 of file netgroup.cpp.
std::vector< unsigned char > NetGroupManager::GetGroup | ( | const CNetAddr & | address | ) | const |
Get the canonical identifier of the network group for address.
The groups are assigned in a way where it should be costly for an attacker to obtain addresses with many different group identifiers, even if it is cheap to obtain addresses with the same identifier.
Definition at line 18 of file netgroup.cpp.
uint32_t NetGroupManager::GetMappedAS | ( | const CNetAddr & | address | ) | const |
Get the autonomous system on the BGP path to address.
The ip->AS mapping depends on how asmap is constructed.
Definition at line 81 of file netgroup.cpp.
bool NetGroupManager::UsingASMap | ( | ) | const |
Indicates whether ASMap is being used for clearnet bucketing.
Definition at line 130 of file netgroup.cpp.
|
private |
Compressed IP->ASN mapping, loaded from a file when a node starts.
This mapping is then used for bucketing nodes in Addrman and for ensuring we connect to a diverse set of peers in Connman. The map is empty if no file was provided.
If asmap is provided, nodes will be bucketed by AS they belong to, in order to make impossible for a node to connect to several nodes hosted in a single AS. This is done in response to Erebus attack, but also to generally diversify the connections every node creates, especially useful when a large fraction of nodes operate under a couple of cloud providers.
If a new asmap is provided, the existing addrman records are re-bucketed.
This is initialized in the constructor, const, and therefore is thread-safe.
Definition at line 73 of file netgroup.h.