mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-29 10:43:14 +00:00
Merge pull request #6720
86abf558c
epee: Remove unused functions in local_ip.h (Jean Pierre Dudey)
This commit is contained in:
commit
7db379cc82
1 changed files with 0 additions and 26 deletions
|
@ -28,8 +28,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
|
||||||
#include <boost/asio/ip/address_v6.hpp>
|
|
||||||
#include "int-util.h"
|
#include "int-util.h"
|
||||||
|
|
||||||
// IP addresses are kept in network byte order
|
// IP addresses are kept in network byte order
|
||||||
|
@ -40,30 +38,6 @@ namespace epee
|
||||||
{
|
{
|
||||||
namespace net_utils
|
namespace net_utils
|
||||||
{
|
{
|
||||||
|
|
||||||
inline
|
|
||||||
bool is_ipv6_local(const std::string& ip)
|
|
||||||
{
|
|
||||||
auto addr = boost::asio::ip::address_v6::from_string(ip);
|
|
||||||
|
|
||||||
// ipv6 link-local unicast addresses are fe80::/10
|
|
||||||
bool is_link_local = addr.is_link_local();
|
|
||||||
|
|
||||||
auto addr_bytes = addr.to_bytes();
|
|
||||||
|
|
||||||
// ipv6 unique local unicast addresses start with fc00::/7 -- (fcXX or fdXX)
|
|
||||||
bool is_unique_local_unicast = (addr_bytes[0] == 0xfc || addr_bytes[0] == 0xfd);
|
|
||||||
|
|
||||||
return is_link_local || is_unique_local_unicast;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool is_ipv6_loopback(const std::string& ip)
|
|
||||||
{
|
|
||||||
// ipv6 loopback is ::1
|
|
||||||
return boost::asio::ip::address_v6::from_string(ip).is_loopback();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool is_ip_local(uint32_t ip)
|
bool is_ip_local(uint32_t ip)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue