remove now unused, in_local_network() functions

This commit is contained in:
arvidn 2020-01-15 00:03:49 +01:00 committed by Arvid Norberg
parent b5ea5bb82c
commit 7529d3e67e
2 changed files with 0 additions and 20 deletions

View File

@ -95,13 +95,6 @@ namespace libtorrent {
// netmask
TORRENT_EXTRA_EXPORT address build_netmask(int bits, int family);
// returns true if the specified address is on the same
// local network as us
TORRENT_EXTRA_EXPORT bool in_local_network(io_service& ios, address const& addr
, error_code& ec);
TORRENT_EXTRA_EXPORT bool in_local_network(std::vector<ip_interface> const& net
, address const& addr);
// return the gateway for the given ip_interface, if there is one. Otherwise
// return nullopt.
TORRENT_EXTRA_EXPORT boost::optional<address> get_gateway(

View File

@ -489,19 +489,6 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
== (a2.to_v4().to_ulong() & mask.to_v4().to_ulong());
}
bool in_local_network(io_service& ios, address const& addr, error_code& ec)
{
std::vector<ip_interface> net = enum_net_interfaces(ios, ec);
if (ec) return false;
return in_local_network(net, addr);
}
bool in_local_network(std::vector<ip_interface> const& net, address const& addr)
{
return std::any_of(net.begin(), net.end(), [&addr](ip_interface const& i)
{ return match_addr_mask(addr, i.interface_address, i.netmask); });
}
std::vector<ip_interface> enum_net_interfaces(io_service& ios, error_code& ec)
{
TORRENT_UNUSED(ios); // this may be unused depending on configuration