implement initial mycelium network condition

This commit is contained in:
yggverse 2025-10-04 06:44:34 +03:00
parent edf488cbc3
commit b079fb63c7
2 changed files with 12 additions and 0 deletions

View file

@ -636,6 +636,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

@ -275,6 +275,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;
}
}