mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-17 12:51:49 +02:00
check local address
This commit is contained in:
parent
05c7aacfa5
commit
a74f685a5d
3 changed files with 14 additions and 1 deletions
libi2pd
|
@ -461,6 +461,17 @@ namespace net
|
|||
#endif
|
||||
}
|
||||
|
||||
bool IsLocalAddress (const boost::asio::ip::address& addr)
|
||||
{
|
||||
auto mtu = // TODO: implement better
|
||||
#ifdef _WIN32
|
||||
GetMTUWindows(addr, 0);
|
||||
#else
|
||||
GetMTUUnix(addr, 0);
|
||||
#endif
|
||||
return mtu > 0;
|
||||
}
|
||||
|
||||
bool IsInReservedRange (const boost::asio::ip::address& host)
|
||||
{
|
||||
// https://en.wikipedia.org/wiki/Reserved_IP_addresses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue