1
1
/*
2
- * Copyright (c) 2013-2024 , The PurpleI2P Project
2
+ * Copyright (c) 2013-2025 , The PurpleI2P Project
3
3
*
4
4
* This file is part of Purple i2pd project and licensed under BSD3
5
5
*
8
8
9
9
#include < cstdlib>
10
10
#include < string>
11
+ #include < array>
11
12
#include < unordered_set>
12
13
#include < boost/asio.hpp>
13
14
@@ -123,8 +124,8 @@ const char *inet_ntop_xp(int af, const void *src, char *dst, socklen_t size)
123
124
#endif
124
125
#endif
125
126
126
- #define address_pair_v4 (a,b ) { boost::asio::ip::make_address (a).to_v4 ().to_uint (), boost::asio::ip::make_address (b).to_v4 ().to_uint () }
127
- #define address_pair_v6 (a,b ) { boost::asio::ip::make_address (a).to_v6 ().to_bytes (), boost::asio::ip::make_address (b).to_v6 ().to_bytes () }
127
+ #define address_pair_v4 (a,b ) std::pair { boost::asio::ip::make_address (a).to_v4 ().to_uint (), boost::asio::ip::make_address (b).to_v4 ().to_uint () }
128
+ #define address_pair_v6 (a,b ) std::pair { boost::asio::ip::make_address (a).to_v6 ().to_bytes (), boost::asio::ip::make_address (b).to_v6 ().to_bytes () }
128
129
129
130
namespace i2p
130
131
{
@@ -647,7 +648,8 @@ namespace net
647
648
if (host.is_unspecified ()) return false ;
648
649
if (host.is_v4 ())
649
650
{
650
- static const std::vector< std::pair<uint32_t , uint32_t > > reservedIPv4Ranges {
651
+ static const std::array<std::pair<uint32_t , uint32_t >, 14 > reservedIPv4Ranges
652
+ {
651
653
address_pair_v4 (" 0.0.0.0" , " 0.255.255.255" ),
652
654
address_pair_v4 (" 10.0.0.0" , " 10.255.255.255" ),
653
655
address_pair_v4 (" 100.64.0.0" , " 100.127.255.255" ),
@@ -672,7 +674,8 @@ namespace net
672
674
}
673
675
if (host.is_v6 ())
674
676
{
675
- static const std::vector< std::pair<boost::asio::ip::address_v6::bytes_type, boost::asio::ip::address_v6::bytes_type> > reservedIPv6Ranges {
677
+ static const std::array<std::pair<boost::asio::ip::address_v6::bytes_type, boost::asio::ip::address_v6::bytes_type>, 7 > reservedIPv6Ranges
678
+ {
676
679
address_pair_v6 (" 64:ff9b::" , " 64:ff9b:ffff:ffff:ffff:ffff:ffff:ffff" ), // NAT64
677
680
address_pair_v6 (" 2001:db8::" , " 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff" ),
678
681
address_pair_v6 (" fc00::" , " fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" ),
0 commit comments