Extract address results as HostResolverEndpointResult

This should have the effect of making the new results type the one used
internally to HostResolver.  Results will be cached as the new type and
Any requests for AddressList results will be converted.

Also, some slight modifications to the alias extraction in that no more
attempt is made to sort the aliases into an order, and all alias names
are validated/canonicalized at this point (instead of waiting to do it
later on output from HostResolver).

(Change only made for the built-in resolver.  System resolution still
internally uses AddressList because of all the fun of sharing its
interface with a bunch of mocking support.  Haven't decided yet what I
want to do about all that.)

Bug: 1264933
Change-Id: I0c900dab16b7595f20830237923dbdb4ad616250
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3348233
Reviewed-by: David Benjamin <[email protected]>
Reviewed-by: Adam Rice <[email protected]>
Commit-Queue: Eric Orth <[email protected]>
Cr-Commit-Position: refs/heads/main@{#973911}
diff --git a/net/dns/dns_alias_utility.h b/net/dns/dns_alias_utility.h
index cac7074..6ee0c1cc 100644
--- a/net/dns/dns_alias_utility.h
+++ b/net/dns/dns_alias_utility.h
@@ -8,12 +8,19 @@
 #include <set>
 #include <string>
 
+#include "base/strings/string_piece.h"
 #include "net/base/net_export.h"
 
 namespace net {
 
 namespace dns_alias_utility {
 
+// Validates that `alias` represents a valid DNS alias name, e.g. CNAME, and
+// then URL-canonicalizes the name. Returns empty string if not valid or unable
+// to canonicalize.
+NET_EXPORT_PRIVATE std::string ValidateAndCanonicalizeAlias(
+    base::StringPiece alias);
+
 // Returns a fixed up set of canonicalized aliases (i.e. aliases that are
 // written as hostnames for canonical URLs). The set is stripped of "localhost",
 // IP addresses, duplicates, the empty string, strings longer than