/* * * Modified by ScyllaDB * Copyright (C) 2016-present ScyllaDB */ /* * SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.0 and Apache-2.0) */ #include #include #include #include #include #include "inet_address.hh" using namespace seastar; static_assert(std::is_nothrow_default_constructible_v); static_assert(std::is_nothrow_copy_constructible_v); static_assert(std::is_nothrow_move_constructible_v); future gms::inet_address::lookup(sstring name, opt_family family, opt_family preferred) { return seastar::net::dns::get_host_by_name(std::move(name), family).then([preferred](seastar::net::hostent&& h) { for (auto& addr : h.addr_list) { if (!preferred || addr.in_family() == preferred) { return gms::inet_address(addr); } } return gms::inet_address(h.addr_list.front()); }); }