Avi Drissman | 6459548 | 2022-09-14 20:52:29 | [diff] [blame] | 1 | // Copyright 2020 The Chromium Authors |
Cammie Smith Barnes | 958c7f3 | 2020-12-17 16:43:11 | [diff] [blame] | 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 | |
Eric Orth | ac66191 | 2022-01-10 21:44:17 | [diff] [blame] | 8 | #include <set> |
Cammie Smith Barnes | 958c7f3 | 2020-12-17 16:43:11 | [diff] [blame] | 9 | #include <string> |
Cammie Smith Barnes | 958c7f3 | 2020-12-17 16:43:11 | [diff] [blame] | 10 | |
Eric Orth | 8677ec2a | 2022-02-22 21:31:06 | [diff] [blame] | 11 | #include "base/strings/string_piece.h" |
Cammie Smith Barnes | 958c7f3 | 2020-12-17 16:43:11 | [diff] [blame] | 12 | #include "net/base/net_export.h" |
| 13 | |
Tsuyoshi Horo | 4f516be | 2022-06-14 11:53:13 | [diff] [blame] | 14 | namespace net::dns_alias_utility { |
Cammie Smith Barnes | 958c7f3 | 2020-12-17 16:43:11 | [diff] [blame] | 15 | |
Eric Orth | ac66191 | 2022-01-10 21:44:17 | [diff] [blame] | 16 | // Returns a fixed up set of canonicalized aliases (i.e. aliases that are |
| 17 | // written as hostnames for canonical URLs). The set is stripped of "localhost", |
| 18 | // IP addresses, duplicates, the empty string, strings longer than |
| 19 | // `dns_protocol::kMaxCharNameLength` characters (with one extra character |
| 20 | // allowed for fully-qualified hostnames, i.e. hostnames ending with '.'), and |
| 21 | // any strings that fail to URL-canonicalize as hosts. The remaining aliases are |
| 22 | // replaced with their canonicalized forms. |
| 23 | NET_EXPORT_PRIVATE std::set<std::string> FixUpDnsAliases( |
| 24 | const std::set<std::string>& aliases); |
Cammie Smith Barnes | 958c7f3 | 2020-12-17 16:43:11 | [diff] [blame] | 25 | |
Tsuyoshi Horo | 4f516be | 2022-06-14 11:53:13 | [diff] [blame] | 26 | } // namespace net::dns_alias_utility |
Cammie Smith Barnes | 958c7f3 | 2020-12-17 16:43:11 | [diff] [blame] | 27 | |
| 28 | #endif // NET_DNS_DNS_ALIAS_UTILITY_H_ |