mirror of
https://github.com/monero-project/monero.git
synced 2025-05-08 18:15:05 -04:00
allow blocking whole subnets
This commit is contained in:
parent
515ac2951d
commit
65c4004963
19 changed files with 413 additions and 34 deletions
|
@ -524,6 +524,24 @@ TEST(get_network_address, ipv4)
|
|||
EXPECT_STREQ("23.0.0.254:2000", address->str().c_str());
|
||||
}
|
||||
|
||||
TEST(get_network_address, ipv4subnet)
|
||||
{
|
||||
expect<epee::net_utils::ipv4_network_subnet> address = net::get_ipv4_subnet_address("0.0.0.0", true);
|
||||
EXPECT_STREQ("0.0.0.0/32", address->str().c_str());
|
||||
|
||||
address = net::get_ipv4_subnet_address("0.0.0.0");
|
||||
EXPECT_TRUE(!address);
|
||||
|
||||
address = net::get_ipv4_subnet_address("0.0.0.0/32");
|
||||
EXPECT_STREQ("0.0.0.0/32", address->str().c_str());
|
||||
|
||||
address = net::get_ipv4_subnet_address("0.0.0.0/0");
|
||||
EXPECT_STREQ("0.0.0.0/0", address->str().c_str());
|
||||
|
||||
address = net::get_ipv4_subnet_address("12.34.56.78/16");
|
||||
EXPECT_STREQ("12.34.0.0/16", address->str().c_str());
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
using stream_type = boost::asio::ip::tcp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue