1CURLOPT_DNS_SHUFFLE_ADDRESSEcSu(r3l)_easy_setopt optCiUoRnLsOPT_DNS_SHUFFLE_ADDRESSES(3)
2
3
4
6 CURLOPT_DNS_SHUFFLE_ADDRESSES - Shuffle addresses when a hostname
7 returns more than one
8
10 #include <curl/curl.h>
11
12 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff);
13
15 When a name is resolved and more than one IP address is returned, shuf‐
16 fle the order of all returned addresses so that they will be used in a
17 random order. This is similar to the ordering behavior of gethostby‐
18 name which is no longer used on most platforms.
19
20 Addresses will not be reshuffled if a name resolution is completed
21 using the DNS cache. CURLOPT_DNS_CACHE_TIMEOUT(3) can be used together
22 with this option to reduce DNS cache timeout or disable caching
23 entirely if frequent reshuffling is needed.
24
25 Since the addresses returned will be reordered randomly, their order
26 will not be in accordance with RFC 3484 or any other deterministic
27 order that may be generated by the system's name resolution implementa‐
28 tion. This may have performance impacts and may cause IPv4 to be used
29 before IPv6 or vice versa.
30
32 0 (disabled)
33
35 All
36
38 CURL *curl = curl_easy_init();
39 if(curl) {
40 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
41 curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
42
43 curl_easy_perform(curl);
44
45 /* always cleanup */
46 curl_easy_cleanup(curl);
47 }
48
50 Added in 7.60.0
51
53 CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
54
56 CURLOPT_DNS_CACHE_TIMEOUT(3), CURLOPT_IPRESOLVE(3),
57
58
59
60libcurl 7.64.0 March 17, 2018CURLOPT_DNS_SHUFFLE_ADDRESSES(3)