mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -03:00
Add and use CNetAddr::HasCJDNSPrefix() helper
This commit is contained in:
parent
5ba73cd0ee
commit
fb4265747c
3 changed files with 3 additions and 3 deletions
|
@ -275,7 +275,7 @@ std::optional<CService> GetLocalAddrForPeer(CNode& node)
|
||||||
CService MaybeFlipIPv6toCJDNS(const CService& service)
|
CService MaybeFlipIPv6toCJDNS(const CService& service)
|
||||||
{
|
{
|
||||||
CService ret{service};
|
CService ret{service};
|
||||||
if (ret.m_net == NET_IPV6 && ret.m_addr[0] == 0xfc && IsReachable(NET_CJDNS)) {
|
if (ret.m_net == NET_IPV6 && ret.HasCJDNSPrefix() && IsReachable(NET_CJDNS)) {
|
||||||
ret.m_net = NET_CJDNS;
|
ret.m_net = NET_CJDNS;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -450,8 +450,7 @@ bool CNetAddr::IsValid() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CJDNS addresses always start with 0xfc
|
if (IsCJDNS() && !HasCJDNSPrefix()) {
|
||||||
if (IsCJDNS() && (m_addr[0] != 0xFC)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,7 @@ public:
|
||||||
bool IsTor() const;
|
bool IsTor() const;
|
||||||
bool IsI2P() const;
|
bool IsI2P() const;
|
||||||
bool IsCJDNS() const;
|
bool IsCJDNS() const;
|
||||||
|
[[nodiscard]] bool HasCJDNSPrefix() const { return m_addr[0] == 0xfc; }
|
||||||
bool IsLocal() const;
|
bool IsLocal() const;
|
||||||
bool IsRoutable() const;
|
bool IsRoutable() const;
|
||||||
bool IsInternal() const;
|
bool IsInternal() const;
|
||||||
|
|
Loading…
Reference in a new issue