blob: 99b9b0144b518d21e59f8f020ae157e3469e1de4 [file] [log] [blame]
Avi Drissman64595482022-09-14 20:52:291// Copyright 2021 The Chromium Authors
Eric Orthd39d0672021-11-16 21:17:582// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Yoichiro Hibara4d2c1dcbb52022-09-05 23:56:475#ifndef NET_DNS_PUBLIC_HOST_RESOLVER_RESULTS_H_
6#define NET_DNS_PUBLIC_HOST_RESOLVER_RESULTS_H_
Eric Orthd39d0672021-11-16 21:17:587
8#include <string>
Eric Orthc869186e2022-01-11 00:18:439#include <tuple>
Eric Orthd39d0672021-11-16 21:17:5810#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
16namespace net {
17
18// Host-resolution-result representation of a single endpoint and the
19// information necessary to attempt a connection to that endpoint.
20struct 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
Eric Orthc869186e2022-01-11 00:18:4330 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
Eric Orth92c07712021-12-02 17:54:5838 // IP endpoints at which to connect to the service.
39 std::vector<net::IPEndPoint> ip_endpoints;
Eric Orthd39d0672021-11-16 21:17:5840
Eric Orthd39d0672021-11-16 21:17:5841 // Additional metadata for creating connections to the endpoint. Typically
42 // sourced from DNS HTTPS records.
43 ConnectionEndpointMetadata metadata;
44};
45
Yoichiro Hibaracf4081df2022-09-12 13:15:4246using HostResolverEndpointResults =
47 std::vector<net::HostResolverEndpointResult>;
48
Eric Orthd39d0672021-11-16 21:17:5849} // namespace net
50
Yoichiro Hibara4d2c1dcbb52022-09-05 23:56:4751#endif // NET_DNS_PUBLIC_HOST_RESOLVER_RESULTS_H_