Normalize IPv4-mapped IPv4 addresses before checking PC/LAN/WAN type
This commit is contained in:
parent
3d6e7f447a
commit
6b5a712506
2 changed files with 10 additions and 1 deletions
|
|
@ -44,7 +44,7 @@ namespace net {
|
|||
|
||||
net_e
|
||||
from_address(const std::string_view &view) {
|
||||
auto addr = ip::make_address(view);
|
||||
auto addr = normalize_address(ip::make_address(view));
|
||||
|
||||
if (addr.is_v6()) {
|
||||
for (auto &range : pc_ips_v6) {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,15 @@ namespace net {
|
|||
std::string_view
|
||||
af_to_any_address_string(af_e af);
|
||||
|
||||
/**
|
||||
* @brief Converts an address to a normalized form.
|
||||
* @details Normalization converts IPv4-mapped IPv6 addresses into IPv4 addresses.
|
||||
* @param address The address to normalize.
|
||||
* @return Normalized address.
|
||||
*/
|
||||
boost::asio::ip::address
|
||||
normalize_address(boost::asio::ip::address address);
|
||||
|
||||
/**
|
||||
* @brief Returns the given address in normalized string form.
|
||||
* @details Normalization converts IPv4-mapped IPv6 addresses into IPv4 addresses.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue