tls_slot_.set([&](Event::Dispatcher&) { return std::make_shared<ThreadLocalHostInfo>(*this); });
!(context.api().bootstrap().typed_dns_resolver_config().typed_config().type_url().empty())) {
DnsCacheImpl::loadDnsCacheEntryWithForceRefresh(absl::string_view raw_host, uint16_t default_port,
if (tls_host != primary_hosts_.end() && tls_host->second->host_info_->firstResolveComplete()) {
absl::optional<const DnsHostInfoSharedPtr> DnsCacheImpl::getHost(absl::string_view host_name) {
finishResolve(host, Network::DnsResolver::ResolutionStatus::Completed, "proxy_resolve", {}, {},
// matter, but we could consider collapsing these down and sharing the underlying DNS resolution.
ENVOY_LOG(debug, "host='{}' TTL check: now={} last_used={} TTL {}", host, now_duration.count(),
ENVOY_LOG_EVENT(debug, "force_refresh_host", "force refreshing host='{}'", primary_host.first);
void DnsCacheImpl::setIpVersionToRemove(absl::optional<Network::Address::IpVersion> ip_version) {
ENVOY_LOG(debug, "starting main thread resolve for host='{}' dns='{}' port='{}' timeout='{}'",
bool failure = status == Network::DnsResolver::ResolutionStatus::Failure || response.empty();
// If the DNS resolver successfully resolved with an empty response list, the dns cache does not
// update. This ensures that a potentially previously resolved address does not stabilize back to
primary_host_info->host_info_->setAddresses(std::move(address_list), details_with_maybe_trace,
std::string value = absl::StrJoin(address_list, "\n", [&](std::string* out, const auto& addr) {
DnsCacheImpl::parseValue(absl::string_view value, absl::optional<MonotonicTime>& resolution_time) {
Config::Utility::getAndCheckFactory<KeyValueStoreFactory>(config.key_value_config().config());
KeyValueStore::ConstIterateCb load = [this](const std::string& key, const std::string& value) {
const std::string& DnsCacheImpl::DnsHostInfoImpl::resolvedHost() const { return resolved_host_; }
last_used_time_ = parent_.main_thread_dispatcher_.timeSource().monotonicTime().time_since_epoch();
Network::DnsResolver::ResolutionStatus DnsCacheImpl::DnsHostInfoImpl::resolutionStatus() const {