Commit fd2f5137 authored by Joseph Noir's avatar Joseph Noir

Use resolve to get local addresses for any addr

parent 86e62c53
...@@ -226,13 +226,10 @@ std::vector<ip_address> local_addresses(string_view host) { ...@@ -226,13 +226,10 @@ std::vector<ip_address> local_addresses(string_view host) {
} }
std::vector<ip_address> local_addresses(ip_address host) { std::vector<ip_address> local_addresses(ip_address host) {
auto v6_any = ip_address{{0}, {0}}; static auto v6_any = ip_address{{0}, {0}};
auto v4_any = ip_address{make_ipv4_address(0, 0, 0, 0)}; static auto v4_any = ip_address{make_ipv4_address(0, 0, 0, 0)};
// TODO: If is any addr, call resolve with PR #23. if (host == v4_any || host == v6_any)
if (host == v4_any) return resolve("");
return {ip_address{make_ipv4_address(0, 0, 0, 0)}};
if (host == v6_any)
return {ip_address{}};
auto link_local = ip_address({0xfe, 0x8, 0x0, 0x0}, {0x0, 0x0, 0x0, 0x0}); auto link_local = ip_address({0xfe, 0x8, 0x0, 0x0}, {0x0, 0x0, 0x0, 0x0});
auto ll_prefix = ip_subnet(link_local, 10); auto ll_prefix = ip_subnet(link_local, 10);
// Unless explicitly specified we are going to skip link-local addresses. // Unless explicitly specified we are going to skip link-local addresses.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment