userver: clients::dns::Resolver Class Reference
Loading...
Searching...
No Matches
clients::dns::Resolver Class Reference

#include <userver/clients/dns/resolver.hpp>

Detailed Description

Caching DNS resolver implementation.

Usually retrieved from clients::dns::Component.

Combines file-based (/etc/hosts) name resolution with network-based one.

Definition at line 28 of file resolver.hpp.

Classes

struct  LookupSourceCounters

Public Member Functions

 Resolver (engine::TaskProcessor &fs_task_processor, const ::userver::static_config::DnsClient &config)
 Resolver (const Resolver &)=delete
 Resolver (Resolver &&)=delete
AddrVector Resolve (const std::string &name, engine::Deadline deadline)
const LookupSourceCountersGetLookupSourceCounters () const
 Returns lookup source counters.
void ReloadHosts ()
 Forces the reload of lookup table file. Waits until the reload is done.
void FlushNetworkCache ()
 Resets the network results cache.
void FlushNetworkCache (const std::string &name)
 Removes the specified domain name from the network results cache.
void WriteMetrics (utils::statistics::Writer &writer) const

Member Function Documentation

◆ Resolve()

AddrVector clients::dns::Resolver::Resolve ( const std::string & name,
engine::Deadline deadline )

Performs a domain name resolution.

Sources are tried in the following order:

  • Cached file lookup table
  • Cached network resolution results
  • Network name servers
Exceptions
clients::dns::NotResolvedExceptionif none of the sources provide a result within the specified deadline.

The documentation for this class was generated from the following file: