Bitcoin Core  27.99.0
P2P Digital Currency
netgroup.h
Go to the documentation of this file.
1 // Copyright (c) 2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_NETGROUP_H
6 #define BITCOIN_NETGROUP_H
7 
8 #include <netaddress.h>
9 #include <uint256.h>
10 
11 #include <vector>
12 
17 public:
18  explicit NetGroupManager(std::vector<bool> asmap)
19  : m_asmap{std::move(asmap)}
20  {}
21 
23  uint256 GetAsmapChecksum() const;
24 
35  std::vector<unsigned char> GetGroup(const CNetAddr& address) const;
36 
42  uint32_t GetMappedAS(const CNetAddr& address) const;
43 
47  void ASMapHealthCheck(const std::vector<CNetAddr>& clearnet_addrs) const;
48 
52  bool UsingASMap() const;
53 
54 private:
73  const std::vector<bool> m_asmap;
74 };
75 
76 #endif // BITCOIN_NETGROUP_H
Network address.
Definition: netaddress.h:112
Netgroup manager.
Definition: netgroup.h:16
uint256 GetAsmapChecksum() const
Get a checksum identifying the asmap being used.
Definition: netgroup.cpp:11
bool UsingASMap() const
Indicates whether ASMap is being used for clearnet bucketing.
Definition: netgroup.cpp:130
const std::vector< bool > m_asmap
Compressed IP->ASN mapping, loaded from a file when a node starts.
Definition: netgroup.h:73
void ASMapHealthCheck(const std::vector< CNetAddr > &clearnet_addrs) const
Analyze and log current health of ASMap based buckets.
Definition: netgroup.cpp:114
std::vector< unsigned char > GetGroup(const CNetAddr &address) const
Get the canonical identifier of the network group for address.
Definition: netgroup.cpp:18
uint32_t GetMappedAS(const CNetAddr &address) const
Get the autonomous system on the BGP path to address.
Definition: netgroup.cpp:81
NetGroupManager(std::vector< bool > asmap)
Definition: netgroup.h:18
256-bit opaque blob.
Definition: uint256.h:106