CURLOPT_DNS_SHUFFLE_ADDRESSES.3 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_DNS_SHUFFLE_ADDRESSES 3 "3 March 2018" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_DNS_SHUFFLE_ADDRESSES \- shuffle IP addresses for hostname
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff);
  32. .fi
  33. .SH DESCRIPTION
  34. When a name is resolved and more than one IP address is returned, shuffle the
  35. order of all returned addresses so that they will be used in a random order.
  36. This is similar to the ordering behavior of gethostbyname which is no longer
  37. used on most platforms.
  38. Addresses will not be reshuffled if a name resolution is completed using the
  39. DNS cache. \fICURLOPT_DNS_CACHE_TIMEOUT(3)\fP can be used together with this
  40. option to reduce DNS cache timeout or disable caching entirely if frequent
  41. reshuffling is needed.
  42. Since the addresses returned will be reordered randomly, their order will not
  43. be in accordance with RFC 3484 or any other deterministic order that may be
  44. generated by the system's name resolution implementation. This may have
  45. performance impacts and may cause IPv4 to be used before IPv6 or vice versa.
  46. .SH DEFAULT
  47. 0 (disabled)
  48. .SH PROTOCOLS
  49. All
  50. .SH EXAMPLE
  51. .nf
  52. CURL *curl = curl_easy_init();
  53. if(curl) {
  54. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  55. curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
  56. curl_easy_perform(curl);
  57. /* always cleanup */
  58. curl_easy_cleanup(curl);
  59. }
  60. .fi
  61. .SH AVAILABILITY
  62. Added in 7.60.0
  63. .SH RETURN VALUE
  64. CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
  65. .SH "SEE ALSO"
  66. .BR CURLOPT_DNS_CACHE_TIMEOUT "(3), " CURLOPT_IPRESOLVE "(3), "