userver: userver/clients/dns/resolver_utils.hpp Source File
Loading...
Searching...
No Matches
resolver_utils.hpp
1#pragma once
2
3#include <userver/clients/dns/exception.hpp>
4#include <userver/clients/dns/resolver_fwd.hpp>
5#include <userver/components/component_fwd.hpp>
6
7USERVER_NAMESPACE_BEGIN
8
9namespace clients::dns {
10
11/// Resolver types used by the components
12enum class ResolverType {
13 kGetaddrinfo, ///< resolve hosts using blocking getaddrinfo call
14 kAsync, ///< use non-blocking resolver
15};
16
17/// Returns pointer to asynchronous resolver interface if required by config
18/// or nullptr for getaddrinfo
19/// @throws InvalidConfigException on unknown resolver type in config
20clients::dns::Resolver* GetResolverPtr(
21 const components::ComponentConfig& config,
22 const components::ComponentContext& context,
23 ResolverType default_type = ResolverType::kAsync);
24
25} // namespace clients::dns
26
27USERVER_NAMESPACE_END