CernVM-FS
2.12.0
|
#include <dns.h>
Public Member Functions | |
Resolver (const bool ipv4_only, const unsigned retries, const unsigned timeout_ms) | |
virtual | ~Resolver () |
virtual bool | SetResolvers (const std::vector< std::string > &resolvers)=0 |
virtual bool | SetSearchDomains (const std::vector< std::string > &domains)=0 |
virtual void | SetSystemResolvers ()=0 |
virtual void | SetSystemSearchDomains ()=0 |
Host | Resolve (const std::string &name) |
void | ResolveMany (const std::vector< std::string > &names, std::vector< Host > *hosts) |
const std::vector< std::string > & | domains () const |
bool | ipv4_only () const |
const std::vector< std::string > & | resolvers () const |
unsigned | retries () const |
unsigned | timeout_ms () const |
void | set_throttle (const unsigned throttle) |
unsigned | throttle () const |
void | set_min_ttl (unsigned seconds) |
unsigned | min_ttl () const |
void | set_max_ttl (unsigned seconds) |
unsigned | max_ttl () const |
Static Public Attributes | |
static const unsigned | kDefaultMinTtl = 60 |
static const unsigned | kDefaultMaxTtl = 86400 |
Protected Member Functions | |
virtual void | DoResolve (const std::vector< std::string > &names, const std::vector< bool > &skip, std::vector< std::vector< std::string > > *ipv4_addresses, std::vector< std::vector< std::string > > *ipv6_addresses, std::vector< Failures > *failures, std::vector< unsigned > *ttls, std::vector< std::string > *fqdns)=0 |
bool | IsIpv4Address (const std::string &address) |
bool | IsIpv6Address (const std::string &address) |
Protected Attributes | |
std::vector< std::string > | domains_ |
bool | ipv4_only_ |
std::vector< std::string > | resolvers_ |
unsigned | retries_ |
unsigned | timeout_ms_ |
unsigned | throttle_ |
unsigned | min_ttl_ |
unsigned | max_ttl_ |
Prng | prng_ |
Additional Inherited Members | |
Private Member Functions inherited from SingleCopy | |
SingleCopy () | |
Abstract interface of a name resolver. Returns a Host object upon successful name resolution. Also provides a vector interface to resolve multiple names in parallel. Can be configured with DNS servers, with a timeout, and whether to use IPv4 only or not.
dns::Resolver::Resolver | ( | const bool | ipv4_only, |
const unsigned | retries, | ||
const unsigned | timeout_ms | ||
) |
|
inline |
Definition at line 200 of file dns.h.
Referenced by dns::NormalResolver::Create(), dns::HostfileResolver::DoResolve(), dns::CaresResolver::SetSearchDomains(), dns::HostfileResolver::SetSearchDomains(), dns::NormalResolver::SetSearchDomains(), and dns::NormalResolver::SetSystemSearchDomains().
|
protectedpure virtual |
Takes host names and returns the resolved lists of A and AAAA records in the same order. To keep it simple, returns only a single TTL per host, the lower value of both record types A/AAAA. The output vectors have the same size as the input vector names. Names that are handled by the base class are marked with skip[i] set to true. The input names are completed to fully qualified domain names.
Implemented in dns::NormalResolver, dns::HostfileResolver, and dns::CaresResolver.
Referenced by ResolveMany().
|
inline |
Definition at line 201 of file dns.h.
Referenced by dns::CaresResolver::DoResolve(), and dns::HostfileResolver::ParseHostFile().
|
protected |
Basic input validation to ensure that this could syntactically represent a valid IPv4 address.
Definition at line 308 of file dns.cc.
Referenced by dns::HostfileResolver::ParseHostFile(), and ResolveMany().
|
protected |
Basic input validation to ensure that this could syntactically represent a valid IPv6 address.
Definition at line 332 of file dns.cc.
Referenced by ResolveMany().
|
inline |
Definition at line 210 of file dns.h.
Referenced by download::DownloadManager::Clone().
|
inline |
Definition at line 208 of file dns.h.
Referenced by download::DownloadManager::Clone(), and download::DownloadManager::SetProxyChain().
Host dns::Resolver::Resolve | ( | const std::string & | name | ) |
void dns::Resolver::ResolveMany | ( | const std::vector< std::string > & | names, |
std::vector< Host > * | hosts | ||
) |
Calls the overwritten concrete resolver, verifies the sanity of the returned addresses and constructs the Host objects in the same order as the names.
Definition at line 370 of file dns.cc.
Referenced by Resolve(), and download::DownloadManager::SetProxyChain().
|
inline |
Definition at line 202 of file dns.h.
Referenced by dns::NormalResolver::Create(), and dns::CaresResolver::SetResolvers().
|
inline |
Definition at line 203 of file dns.h.
Referenced by download::DownloadManager::Clone(), dns::CaresResolver::Create(), dns::NormalResolver::Create(), and download::DownloadManager::SetDnsParameters().
|
inline |
Definition at line 209 of file dns.h.
Referenced by download::DownloadManager::SetDnsTtlLimits().
|
inline |
Definition at line 207 of file dns.h.
Referenced by download::DownloadManager::SetDnsTtlLimits().
|
inline |
Definition at line 205 of file dns.h.
Referenced by download::DownloadManager::SetMaxIpaddrPerProxy().
|
pure virtual |
A list of new resolvers in the form <IP address>="">[:port].
Implemented in dns::NormalResolver, dns::HostfileResolver, and dns::CaresResolver.
|
pure virtual |
Implemented in dns::NormalResolver, dns::HostfileResolver, and dns::CaresResolver.
|
pure virtual |
Implemented in dns::NormalResolver, dns::HostfileResolver, and dns::CaresResolver.
|
pure virtual |
Implemented in dns::NormalResolver, dns::HostfileResolver, and dns::CaresResolver.
|
inline |
Definition at line 206 of file dns.h.
Referenced by download::DownloadManager::Clone(), and set_throttle().
|
inline |
Definition at line 204 of file dns.h.
Referenced by download::DownloadManager::Clone(), dns::CaresResolver::Create(), dns::NormalResolver::Create(), download::DownloadManager::SetDnsParameters(), and dns::CaresResolver::WaitOnCares().
|
protected |
Currently active search domain list
Definition at line 234 of file dns.h.
Referenced by dns::CaresResolver::Create(), dns::NormalResolver::Create(), domains(), dns::CaresResolver::SetSearchDomains(), and dns::HostfileResolver::SetSearchDomains().
|
protected |
Do not try to get AAAA records if true.
Definition at line 239 of file dns.h.
Referenced by ipv4_only().
|
static |
Cut off very large TTLs by default to 1 day.
Definition at line 182 of file dns.h.
Referenced by MountPoint::SetupDnsTuning().
|
static |
Enlarge very small TTLs by default to 1 minute.
Definition at line 177 of file dns.h.
Referenced by MountPoint::SetupDnsTuning().
|
protected |
Effective maximum TTL, which by default is kDefaultMaxTtl
Definition at line 272 of file dns.h.
Referenced by max_ttl(), ResolveMany(), and set_max_ttl().
|
protected |
Effective minimum TTL, which by default is kDefaultMinTtl
Definition at line 267 of file dns.h.
Referenced by dns::HostfileResolver::DoResolve(), min_ttl(), ResolveMany(), and set_min_ttl().
|
protected |
Required for picking IP addresses in throttle_
Definition at line 277 of file dns.h.
Referenced by ResolveMany(), and Resolver().
|
protected |
Currently used resolver list in the form <ip address>="">:<port>
Definition at line 244 of file dns.h.
Referenced by dns::CaresResolver::Create(), dns::NormalResolver::Create(), resolvers(), and dns::CaresResolver::SetResolvers().
|
protected |
1 + retries_ attempts to unresponsive servers, each attempt bounded by timeout_ms_
Definition at line 250 of file dns.h.
Referenced by dns::NormalResolver::Create(), and retries().
|
protected |
Limit number of resolved IP addresses. If throttle_ is 0 it has no effect. Otherwise, if more than thottle_ IPs are registered for a host, only throttle_ randomly picked IPs are returned.
Definition at line 262 of file dns.h.
Referenced by ResolveMany(), set_throttle(), and throttle().
|
protected |
Timeout in milliseconds for DNS queries. Zero means no timeout.
Definition at line 255 of file dns.h.
Referenced by dns::NormalResolver::Create(), and timeout_ms().