CURLOPT_DNS_SHUFFLE_ADDRESSES.3 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. .\" generated by cd2nroff 0.1 from CURLOPT_DNS_SHUFFLE_ADDRESSES.md
  2. .TH CURLOPT_DNS_SHUFFLE_ADDRESSES 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_DNS_SHUFFLE_ADDRESSES \- shuffle IP addresses for hostname
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long set to 1 to enable this option.
  12. When a name is resolved and more than one IP address is returned, this
  13. function shuffles the order of all returned addresses so that they are used in
  14. a random order. This is similar to the ordering behavior of the legacy
  15. gethostbyname function which is no longer used on most platforms.
  16. Addresses are not reshuffled if name resolution is completed using the DNS
  17. cache. \fICURLOPT_DNS_CACHE_TIMEOUT(3)\fP can be used together with this
  18. option to reduce DNS cache timeout or disable caching entirely if frequent
  19. reshuffling is needed.
  20. Since the addresses returned are randomly reordered, the order is not in
  21. accordance with RFC 3484 or any other deterministic order that may be
  22. generated by the system\(aqs name resolution implementation. This may have
  23. performance impacts and may cause IPv4 to be used before IPv6 or vice versa.
  24. .SH DEFAULT
  25. 0 (disabled)
  26. .SH PROTOCOLS
  27. This functionality affects all supported protocols
  28. .SH EXAMPLE
  29. .nf
  30. int main(void)
  31. {
  32. CURL *curl = curl_easy_init();
  33. if(curl) {
  34. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  35. curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
  36. curl_easy_perform(curl);
  37. /* always cleanup */
  38. curl_easy_cleanup(curl);
  39. }
  40. }
  41. .fi
  42. .SH AVAILABILITY
  43. Added in curl 7.60.0
  44. .SH RETURN VALUE
  45. CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
  46. .SH SEE ALSO
  47. .BR CURLOPT_DNS_CACHE_TIMEOUT (3),
  48. .BR CURLOPT_IPRESOLVE (3)