host_resolver_results.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef NET_DNS_HOST_RESOLVER_RESULTS_H_
  5. #define NET_DNS_HOST_RESOLVER_RESULTS_H_
  6. #include <string>
  7. #include <tuple>
  8. #include <vector>
  9. #include "net/base/connection_endpoint_metadata.h"
  10. #include "net/base/ip_endpoint.h"
  11. #include "net/base/net_export.h"
  12. namespace net {
  13. // Host-resolution-result representation of a single endpoint and the
  14. // information necessary to attempt a connection to that endpoint.
  15. struct NET_EXPORT_PRIVATE HostResolverEndpointResult {
  16. HostResolverEndpointResult();
  17. ~HostResolverEndpointResult();
  18. HostResolverEndpointResult(const HostResolverEndpointResult&);
  19. HostResolverEndpointResult& operator=(const HostResolverEndpointResult&) =
  20. default;
  21. HostResolverEndpointResult(HostResolverEndpointResult&&);
  22. HostResolverEndpointResult& operator=(HostResolverEndpointResult&&) = default;
  23. bool operator==(const HostResolverEndpointResult& other) const {
  24. return std::tie(ip_endpoints, metadata) ==
  25. std::tie(other.ip_endpoints, other.metadata);
  26. }
  27. bool operator!=(const HostResolverEndpointResult& other) const {
  28. return !(*this == other);
  29. }
  30. // IP endpoints at which to connect to the service.
  31. std::vector<net::IPEndPoint> ip_endpoints;
  32. // Additional metadata for creating connections to the endpoint. Typically
  33. // sourced from DNS HTTPS records.
  34. ConnectionEndpointMetadata metadata;
  35. };
  36. } // namespace net
  37. #endif // NET_DNS_HOST_RESOLVER_RESULTS_H_