mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-10-23 12:09:03 +01:00
implement initial mycelium network condition
This commit is contained in:
parent
edf488cbc3
commit
b079fb63c7
2 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue