10#include <userver/engine/io/sockaddr.hpp>
11#include <userver/engine/task/task.hpp>
13USERVER_NAMESPACE_BEGIN
15namespace internal::net {
21class DnsServerMock final {
23 enum class RecordType {
31 RecordType type{RecordType::kInvalid};
37 std::variant<std::monostate, engine::io::Sockaddr, std::string>;
39 RecordType type{RecordType::kInvalid};
44 using DnsAnswerVector = std::vector<DnsAnswer>;
46 struct NoAnswer : std::exception {};
49 using DnsHandler = std::function<DnsAnswerVector(
const DnsQuery&)>;
51 explicit DnsServerMock(DnsHandler);
53 std::string GetServerAddress()
const;
56 void ProcessRequests();
58 std::shared_ptr<internal::net::UdpListener> listener_;
60 engine::Task receiver_task_;