Bitcoin
|
#include <netaddress.h>
Public Member Functions | |
CNetAddr () | |
CNetAddr (const struct in_addr &ipv4Addr) | |
void | SetIP (const CNetAddr &ip) |
bool | SetInternal (const std::string &name) |
bool | SetSpecial (const std::string &strName) |
bool | IsBindAny () const |
bool | IsIPv4 () const |
bool | IsIPv6 () const |
bool | IsRFC1918 () const |
bool | IsRFC2544 () const |
bool | IsRFC6598 () const |
bool | IsRFC5737 () const |
bool | IsRFC3849 () const |
bool | IsRFC3927 () const |
bool | IsRFC3964 () const |
bool | IsRFC4193 () const |
bool | IsRFC4380 () const |
bool | IsRFC4843 () const |
bool | IsRFC7343 () const |
bool | IsRFC4862 () const |
bool | IsRFC6052 () const |
bool | IsRFC6145 () const |
bool | IsTor () const |
bool | IsLocal () const |
bool | IsRoutable () const |
bool | IsInternal () const |
bool | IsValid () const |
enum Network | GetNetwork () const |
std::string | ToString () const |
std::string | ToStringIP () const |
unsigned int | GetByte (int n) const |
uint64_t | GetHash () const |
bool | GetInAddr (struct in_addr *pipv4Addr) const |
std::vector< unsigned char > | GetGroup () const |
int | GetReachabilityFrom (const CNetAddr *paddrPartner=nullptr) const |
CNetAddr (const struct in6_addr &pipv6Addr, const uint32_t scope=0) | |
bool | GetIn6Addr (struct in6_addr *pipv6Addr) const |
template<typename Stream , typename Operation > | |
void | SerializationOp (Stream &s, Operation ser_action) |
Public Attributes | |
ADD_SERIALIZE_METHODS | |
Protected Attributes | |
unsigned char | ip [16] |
uint32_t | scopeId {0} |
Private Member Functions | |
void | SetRaw (Network network, const uint8_t *data) |
Friends | |
class | CSubNet |
bool | operator== (const CNetAddr &a, const CNetAddr &b) |
bool | operator!= (const CNetAddr &a, const CNetAddr &b) |
bool | operator< (const CNetAddr &a, const CNetAddr &b) |
IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96))
CNetAddr::CNetAddr | ( | ) |
Construct an unspecified IPv6 network address (::/128).
|
explicit |
|
explicit |
unsigned int CNetAddr::GetByte | ( | int | n | ) | const |
std::vector< unsigned char > CNetAddr::GetGroup | ( | ) | const |
Get the canonical identifier of our network group
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.
uint64_t CNetAddr::GetHash | ( | ) | const |
bool CNetAddr::GetIn6Addr | ( | struct in6_addr * | pipv6Addr | ) | const |
Try to get our IPv6 address.
[out] | pipv6Addr | The in6_addr struct to which to copy. |
bool CNetAddr::GetInAddr | ( | struct in_addr * | pipv4Addr | ) | const |
Try to get our IPv4 address.
[out] | pipv4Addr | The in_addr struct to which to copy. |
enum Network CNetAddr::GetNetwork | ( | ) | const |
int CNetAddr::GetReachabilityFrom | ( | const CNetAddr * | paddrPartner = nullptr | ) | const |
Calculates a metric for how reachable (*this) is from a given partner
bool CNetAddr::IsBindAny | ( | ) | const |
bool CNetAddr::IsInternal | ( | ) | const |
bool CNetAddr::IsIPv4 | ( | ) | const |
bool CNetAddr::IsIPv6 | ( | ) | const |
bool CNetAddr::IsLocal | ( | ) | const |
bool CNetAddr::IsRFC1918 | ( | ) | const |
bool CNetAddr::IsRFC2544 | ( | ) | const |
bool CNetAddr::IsRFC3849 | ( | ) | const |
bool CNetAddr::IsRFC3927 | ( | ) | const |
bool CNetAddr::IsRFC3964 | ( | ) | const |
bool CNetAddr::IsRFC4193 | ( | ) | const |
bool CNetAddr::IsRFC4380 | ( | ) | const |
bool CNetAddr::IsRFC4843 | ( | ) | const |
bool CNetAddr::IsRFC4862 | ( | ) | const |
bool CNetAddr::IsRFC5737 | ( | ) | const |
bool CNetAddr::IsRFC6052 | ( | ) | const |
bool CNetAddr::IsRFC6145 | ( | ) | const |
bool CNetAddr::IsRFC6598 | ( | ) | const |
bool CNetAddr::IsRFC7343 | ( | ) | const |
bool CNetAddr::IsRoutable | ( | ) | const |
bool CNetAddr::IsTor | ( | ) | const |
bool CNetAddr::IsValid | ( | ) | const |
|
inline |
bool CNetAddr::SetInternal | ( | const std::string & | name | ) |
Try to make this a dummy address that maps the specified name into IPv6 like so: (0xFD + sha256("bitcoin")[0:5]) + sha256(name)[0:10]. Such dummy addresses have a prefix of fd6b:88c0:8724::/48 and are guaranteed to not be publicly routable as it falls under RFC4193's fc00::/7 subnet allocated to unique-local addresses.
CAddrMan uses these fake addresses to keep track of which DNS seeds were used.
void CNetAddr::SetIP | ( | const CNetAddr & | ip | ) |
Set raw IPv4 or IPv6 address (in network byte order)
bool CNetAddr::SetSpecial | ( | const std::string & | strName | ) |
Try to make this a dummy address that maps the specified onion address into IPv6 using OnionCat's range and encoding. Such dummy addresses have a prefix of fd87:d87e:eb43::/48 and are guaranteed to not be publicly routable as they fall under RFC4193's fc00::/7 subnet allocated to unique-local addresses.
std::string CNetAddr::ToString | ( | ) | const |
std::string CNetAddr::ToStringIP | ( | ) | const |
|
friend |
CNetAddr::ADD_SERIALIZE_METHODS |
|
protected |
|
protected |