Bitcoin Core  25.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 
44 private:
63  const std::vector<bool> m_asmap;
64 };
65 
66 #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:10
const std::vector< bool > m_asmap
Compressed IP->ASN mapping, loaded from a file when a node starts.
Definition: netgroup.h:63
std::vector< unsigned char > GetGroup(const CNetAddr &address) const
Get the canonical identifier of the network group for address.
Definition: netgroup.cpp:17
uint32_t GetMappedAS(const CNetAddr &address) const
Get the autonomous system on the BGP path to address.
Definition: netgroup.cpp:80
NetGroupManager(std::vector< bool > asmap)
Definition: netgroup.h:18
256-bit opaque blob.
Definition: uint256.h:106