• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_DNS_DNS_ALIAS_UTILITY_H_
6 #define NET_DNS_DNS_ALIAS_UTILITY_H_
7 
8 #include <set>
9 #include <string>
10 
11 #include "net/base/net_export.h"
12 
13 namespace net::dns_alias_utility {
14 
15 // Returns a fixed up set of canonicalized aliases (i.e. aliases that are
16 // written as hostnames for canonical URLs). The set is stripped of "localhost",
17 // IP addresses, duplicates, the empty string, strings longer than
18 // `dns_protocol::kMaxCharNameLength` characters (with one extra character
19 // allowed for fully-qualified hostnames, i.e. hostnames ending with '.'), and
20 // any strings that fail to URL-canonicalize as hosts. The remaining aliases are
21 // replaced with their canonicalized forms.
22 NET_EXPORT_PRIVATE std::set<std::string> FixUpDnsAliases(
23     const std::set<std::string>& aliases);
24 
25 }  // namespace net::dns_alias_utility
26 
27 #endif  // NET_DNS_DNS_ALIAS_UTILITY_H_
28