This commit is contained in:
oooo-ps 2025-10-19 18:01:21 +02:00 committed by GitHub
commit 48c067ca4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -669,6 +669,17 @@ namespace net
return IsYggdrasilAddress (addr.to_v6 ().to_bytes ().data ());
}
static bool IsMyceliumAddress (const uint8_t addr[16])
{
return addr[0] == 0x04 || addr[0] == 0x05;
}
bool IsMyceliumAddress (const boost::asio::ip::address& addr)
{
if (!addr.is_v6 ()) return false;
return IsMyceliumAddress (addr.to_v6 ().to_bytes ().data ());
}
bool IsPortInReservedRange (const uint16_t port) noexcept
{
// https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers (Feb. 3, 2023) + Tor browser (9150)

View file

@ -295,6 +295,7 @@ namespace util
bool IsLocalAddress (const boost::asio::ip::address& addr);
bool IsInReservedRange (const boost::asio::ip::address& host);
bool IsYggdrasilAddress (const boost::asio::ip::address& addr);
bool IsMyceliumAddress (const boost::asio::ip::address& addr);
bool IsPortInReservedRange (const uint16_t port) noexcept;
}
}