mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
net: extract conditional to bool CNetAddr::IsHeNet
and remove redundant public declaration
This commit is contained in:
@@ -210,6 +210,11 @@ bool CNetAddr::IsRFC7343() const
|
|||||||
return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && (GetByte(12) & 0xF0) == 0x20);
|
return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && (GetByte(12) & 0xF0) == 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CNetAddr::IsHeNet() const
|
||||||
|
{
|
||||||
|
return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x04 && GetByte(12) == 0x70);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns Whether or not this is a dummy address that maps an onion address
|
* @returns Whether or not this is a dummy address that maps an onion address
|
||||||
* into IPv6.
|
* into IPv6.
|
||||||
@@ -516,7 +521,7 @@ std::vector<unsigned char> CNetAddr::GetGroup(const std::vector<bool> &asmap) co
|
|||||||
} else if (IsTor()) {
|
} else if (IsTor()) {
|
||||||
nStartByte = 6;
|
nStartByte = 6;
|
||||||
nBits = 4;
|
nBits = 4;
|
||||||
} else if (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x04 && GetByte(12) == 0x70) {
|
} else if (IsHeNet()) {
|
||||||
// for he.net, use /36 groups
|
// for he.net, use /36 groups
|
||||||
nBits = 36;
|
nBits = 36;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ class CNetAddr
|
|||||||
*/
|
*/
|
||||||
void SetRaw(Network network, const uint8_t *data);
|
void SetRaw(Network network, const uint8_t *data);
|
||||||
|
|
||||||
public:
|
|
||||||
bool SetInternal(const std::string& name);
|
bool SetInternal(const std::string& name);
|
||||||
|
|
||||||
bool SetSpecial(const std::string &strName); // for Tor addresses
|
bool SetSpecial(const std::string &strName); // for Tor addresses
|
||||||
@@ -66,6 +65,7 @@ class CNetAddr
|
|||||||
bool IsRFC4862() const; // IPv6 autoconfig (FE80::/64)
|
bool IsRFC4862() const; // IPv6 autoconfig (FE80::/64)
|
||||||
bool IsRFC6052() const; // IPv6 well-known prefix for IPv4-embedded address (64:FF9B::/96)
|
bool IsRFC6052() const; // IPv6 well-known prefix for IPv4-embedded address (64:FF9B::/96)
|
||||||
bool IsRFC6145() const; // IPv6 IPv4-translated address (::FFFF:0:0:0/96) (actually defined in RFC2765)
|
bool IsRFC6145() const; // IPv6 IPv4-translated address (::FFFF:0:0:0/96) (actually defined in RFC2765)
|
||||||
|
bool IsHeNet() const; // IPv6 Hurricane Electric - https://he.net (2001:0470::/36)
|
||||||
bool IsTor() const;
|
bool IsTor() const;
|
||||||
bool IsLocal() const;
|
bool IsLocal() const;
|
||||||
bool IsRoutable() const;
|
bool IsRoutable() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user