Add EsniContent class for surfacing ESNI results

This patch adds a new class, EsniContent, that serves to
aggregate the results of several ESNI (TLS 1.3 Encrypted Server Name
Indication, draft 4) DNS records and surface them to the
connection stack.

An ESNI DNS query response contains a list of ESNI records, each
of which comprises a "key object" and an optional list of
IP addresses associated with the key object. Aggregating the records
should ensure that:

- each key is only stored once (the spec allows keys to be up to ~60K in
size)
- it is fast to determine which IP addresses have associated keys, and
to iterate over these associated keys (for purposes of prioritizing
addresses in connection establishment)

To do this, an EsniContent object stores a set of bytestrings
(the distinct key objects) and a map from each IP address to a set of
handles to the keys associated with that IP address.

R=ericorth

Bug: 1003494
Change-Id: I0ff2478ef6db6bd9fcb4a685444d96076ed26eae
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862730
Commit-Queue: David Van Cleve <[email protected]>
Reviewed-by: Eric Orth <[email protected]>
Cr-Commit-Position: refs/heads/master@{#707094}
diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn
index bbf7cf2..9c4b840 100644
--- a/net/dns/BUILD.gn
+++ b/net/dns/BUILD.gn
@@ -56,6 +56,7 @@
       "dns_socket_pool.cc",
       "dns_socket_pool.h",
       "dns_transaction.cc",
+      "esni_content.cc",
       "host_cache.cc",
       "host_resolver.cc",
       "host_resolver_manager.cc",
@@ -192,6 +193,7 @@
     sources += [
       "dns_config.h",
       "dns_config_overrides.h",
+      "esni_content.h",
       "host_cache.h",
       "host_resolver.h",
       "mapped_host_resolver.h",
@@ -382,6 +384,7 @@
     "dns_socket_pool_unittest.cc",
     "dns_transaction_unittest.cc",
     "dns_util_unittest.cc",
+    "esni_content_unittest.cc",
     "host_cache_unittest.cc",
     "host_resolver_manager_unittest.cc",
     "mapped_host_resolver_unittest.cc",