mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	use array instead vector for reserved ranges
	
		
			
	
		
	
	
		
	
		
			Some checks are pending
		
		
	
	
		
			
				
	
				Build Debian packages / bookworm (push) Waiting to run
				
			
		
			
				
	
				Build Debian packages / bullseye (push) Waiting to run
				
			
		
			
				
	
				Build Debian packages / buster (push) Waiting to run
				
			
		
			
				
	
				Build on FreeBSD / with UPnP (push) Waiting to run
				
			
		
			
				
	
				Build on OSX / With USE_UPNP=no (push) Waiting to run
				
			
		
			
				
	
				Build on OSX / With USE_UPNP=yes (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / clang-x86_64 (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / i686 (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / ucrt-x86_64 (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / x86_64 (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / CMake clang-x86_64 (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / CMake i686 (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / CMake x86_64 (push) Waiting to run
				
			
		
			
				
	
				Build on Windows / XP (push) Waiting to run
				
			
		
			
				
	
				Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
				
			
		
			
				
	
				Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
				
			
		
			
				
	
				Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
				
			
		
			
				
	
				Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
				
			
		
			
				
	
				Build containers / Building container for linux/amd64 (push) Waiting to run
				
			
		
			
				
	
				Build containers / Building container for linux/arm64 (push) Waiting to run
				
			
		
			
				
	
				Build containers / Building container for linux/arm/v7 (push) Waiting to run
				
			
		
			
				
	
				Build containers / Building container for linux/386 (push) Waiting to run
				
			
		
			
				
	
				Build containers / Pushing merged manifest (push) Blocked by required conditions
				
			
		
		
	
	
				
					
				
			
		
			Some checks are pending
		
		
	
	Build Debian packages / bookworm (push) Waiting to run
				
			Build Debian packages / bullseye (push) Waiting to run
				
			Build Debian packages / buster (push) Waiting to run
				
			Build on FreeBSD / with UPnP (push) Waiting to run
				
			Build on OSX / With USE_UPNP=no (push) Waiting to run
				
			Build on OSX / With USE_UPNP=yes (push) Waiting to run
				
			Build on Windows / clang-x86_64 (push) Waiting to run
				
			Build on Windows / i686 (push) Waiting to run
				
			Build on Windows / ucrt-x86_64 (push) Waiting to run
				
			Build on Windows / x86_64 (push) Waiting to run
				
			Build on Windows / CMake clang-x86_64 (push) Waiting to run
				
			Build on Windows / CMake i686 (push) Waiting to run
				
			Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
				
			Build on Windows / CMake x86_64 (push) Waiting to run
				
			Build on Windows / XP (push) Waiting to run
				
			Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
				
			Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
				
			Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
				
			Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
				
			Build containers / Building container for linux/amd64 (push) Waiting to run
				
			Build containers / Building container for linux/arm64 (push) Waiting to run
				
			Build containers / Building container for linux/arm/v7 (push) Waiting to run
				
			Build containers / Building container for linux/386 (push) Waiting to run
				
			Build containers / Pushing merged manifest (push) Blocked by required conditions
				
			This commit is contained in:
		
							parent
							
								
									6a65680619
								
							
						
					
					
						commit
						2def747564
					
				
					 1 changed files with 8 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
* Copyright (c) 2013-2024, The PurpleI2P Project
 | 
			
		||||
* Copyright (c) 2013-2025, The PurpleI2P Project
 | 
			
		||||
*
 | 
			
		||||
* This file is part of Purple i2pd project and licensed under BSD3
 | 
			
		||||
*
 | 
			
		||||
| 
						 | 
				
			
			@ -8,6 +8,7 @@
 | 
			
		|||
 | 
			
		||||
#include <cstdlib>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <array>
 | 
			
		||||
#include <unordered_set>
 | 
			
		||||
#include <boost/asio.hpp>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -123,8 +124,8 @@ const char *inet_ntop_xp(int af, const void *src, char *dst, socklen_t size)
 | 
			
		|||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#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 () }
 | 
			
		||||
#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 () }
 | 
			
		||||
#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 () }
 | 
			
		||||
#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 () }
 | 
			
		||||
 | 
			
		||||
namespace i2p
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -647,7 +648,8 @@ namespace net
 | 
			
		|||
		if (host.is_unspecified ()) return false;
 | 
			
		||||
		if (host.is_v4())
 | 
			
		||||
		{
 | 
			
		||||
			static const std::vector< std::pair<uint32_t, uint32_t> > reservedIPv4Ranges {
 | 
			
		||||
			static const std::array<std::pair<uint32_t, uint32_t>, 14> reservedIPv4Ranges 
 | 
			
		||||
			{
 | 
			
		||||
				address_pair_v4("0.0.0.0",      "0.255.255.255"),
 | 
			
		||||
				address_pair_v4("10.0.0.0",     "10.255.255.255"),
 | 
			
		||||
				address_pair_v4("100.64.0.0",   "100.127.255.255"),
 | 
			
		||||
| 
						 | 
				
			
			@ -672,7 +674,8 @@ namespace net
 | 
			
		|||
		}
 | 
			
		||||
		if (host.is_v6())
 | 
			
		||||
		{
 | 
			
		||||
			static const std::vector< std::pair<boost::asio::ip::address_v6::bytes_type, boost::asio::ip::address_v6::bytes_type> > reservedIPv6Ranges {
 | 
			
		||||
			static const std::array<std::pair<boost::asio::ip::address_v6::bytes_type, boost::asio::ip::address_v6::bytes_type>, 7> reservedIPv6Ranges 
 | 
			
		||||
			{
 | 
			
		||||
				address_pair_v6("64:ff9b::",  "64:ff9b:ffff:ffff:ffff:ffff:ffff:ffff"),  // NAT64
 | 
			
		||||
				address_pair_v6("2001:db8::", "2001:db8:ffff:ffff:ffff:ffff:ffff:ffff"),
 | 
			
		||||
				address_pair_v6("fc00::",     "fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue