1 // Copyright 2021 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_PUBLIC_HOST_RESOLVER_RESULTS_H_ 6 #define NET_DNS_PUBLIC_HOST_RESOLVER_RESULTS_H_ 7 8 #include <string> 9 #include <tuple> 10 #include <vector> 11 12 #include "net/base/connection_endpoint_metadata.h" 13 #include "net/base/ip_endpoint.h" 14 #include "net/base/net_export.h" 15 16 namespace net { 17 18 // Host-resolution-result representation of a single endpoint and the 19 // information necessary to attempt a connection to that endpoint. 20 struct NET_EXPORT_PRIVATE HostResolverEndpointResult { 21 HostResolverEndpointResult(); 22 ~HostResolverEndpointResult(); 23 24 HostResolverEndpointResult(const HostResolverEndpointResult&); 25 HostResolverEndpointResult& operator=(const HostResolverEndpointResult&) = 26 default; 27 HostResolverEndpointResult(HostResolverEndpointResult&&); 28 HostResolverEndpointResult& operator=(HostResolverEndpointResult&&) = default; 29 30 bool operator==(const HostResolverEndpointResult& other) const { 31 return std::tie(ip_endpoints, metadata) == 32 std::tie(other.ip_endpoints, other.metadata); 33 } 34 bool operator!=(const HostResolverEndpointResult& other) const { 35 return !(*this == other); 36 } 37 38 // IP endpoints at which to connect to the service. 39 std::vector<net::IPEndPoint> ip_endpoints; 40 41 // Additional metadata for creating connections to the endpoint. Typically 42 // sourced from DNS HTTPS records. 43 ConnectionEndpointMetadata metadata; 44 }; 45 46 using HostResolverEndpointResults = 47 std::vector<net::HostResolverEndpointResult>; 48 49 } // namespace net 50 51 #endif // NET_DNS_PUBLIC_HOST_RESOLVER_RESULTS_H_ 52