#include "net/dns/dns_transaction.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
#include "base/base64url.h"
#include "base/containers/circular_deque.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/safe_ref.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/byte_conversions.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "base/timer/elapsed_timer.h"
#include "base/timer/timer.h"
#include "base/values.h"
#include "build/build_config.h"
#include "net/base/backoff_entry.h"
#include "net/base/completion_once_callback.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/idempotency.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/dns/dns_config.h"
#include "net/dns/dns_names_util.h"
#include "net/dns/dns_query.h"
#include "net/dns/dns_response.h"
#include "net/dns/dns_response_result_extractor.h"
#include "net/dns/dns_server_iterator.h"
#include "net/dns/dns_session.h"
#include "net/dns/dns_udp_tracker.h"
#include "net/dns/dns_util.h"
#include "net/dns/host_cache.h"
#include "net/dns/host_resolver_internal_result.h"
#include "net/dns/public/dns_over_https_config.h"
#include "net/dns/public/dns_over_https_server_config.h"
#include "net/dns/public/dns_protocol.h"
#include "net/dns/public/dns_query_type.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/dns/resolve_context.h"
#include "net/http/http_request_headers.h"
#include "net/log/net_log.h"
#include "net/log/net_log_capture_mode.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_values.h"
#include "net/log/net_log_with_source.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/datagram_client_socket.h"
#include "net/socket/stream_socket.h"
#include "net/third_party/uri_template/uri_template.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "url/url_constants.h"
namespace net {
namespace {
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
const char kDnsOverHttpResponseContentType[] = …;
const int64_t kDnsOverHttpResponseMaximumSize = …;
int CountLabels(base::span<const uint8_t> name) { … }
bool IsIPLiteral(const std::string& hostname) { … }
base::Value::Dict NetLogStartParams(const std::string& hostname,
uint16_t qtype) { … }
class DnsAttempt { … };
class DnsUDPAttempt : public DnsAttempt { … };
class DnsHTTPAttempt : public DnsAttempt, public URLRequest::Delegate { … };
void ConstructDnsHTTPAttempt(DnsSession* session,
size_t doh_server_index,
base::span<const uint8_t> qname,
uint16_t qtype,
const OptRecordRdata* opt_rdata,
std::vector<std::unique_ptr<DnsAttempt>>* attempts,
URLRequestContext* url_request_context,
const IsolationInfo& isolation_info,
RequestPriority request_priority,
bool is_probe) { … }
class DnsTCPAttempt : public DnsAttempt { … };
const net::BackoffEntry::Policy kProbeBackoffPolicy = …;
class DnsOverHttpsProbeRunner : public DnsProbeRunner { … };
class DnsTransactionImpl final : public DnsTransaction { … };
class DnsTransactionFactoryImpl : public DnsTransactionFactory { … };
}
DnsTransactionFactory::DnsTransactionFactory() = default;
DnsTransactionFactory::~DnsTransactionFactory() = default;
std::unique_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory(
DnsSession* session) { … }
}