1CURLOPT_DNS_SHUFFLE_ADDRESSEcSu(r3l)_easy_setopt optCiUoRnLsOPT_DNS_SHUFFLE_ADDRESSES(3)
2
3
4

NAME

6       CURLOPT_DNS_SHUFFLE_ADDRESSES - shuffle IP addresses for hostname
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff);
12

DESCRIPTION

14       When a name is resolved and more than one IP address is returned, shuf‐
15       fle the order of all returned addresses so that they will be used in  a
16       random  order.   This is similar to the ordering behavior of gethostby‐
17       name which is no longer used on most platforms.
18
19       Addresses will not be reshuffled if a name resolution is completed  us‐
20       ing  the  DNS  cache. CURLOPT_DNS_CACHE_TIMEOUT(3) can be used together
21       with this option to reduce DNS cache timeout  or  disable  caching  en‐
22       tirely if frequent reshuffling is needed.
23
24       Since  the  addresses  returned will be reordered randomly, their order
25       will not be in accordance with RFC 3484 or any other deterministic  or‐
26       der  that  may be generated by the system's name resolution implementa‐
27       tion. This may have performance impacts and may cause IPv4 to  be  used
28       before IPv6 or vice versa.
29

DEFAULT

31       0 (disabled)
32

PROTOCOLS

34       All
35

EXAMPLE

37       CURL *curl = curl_easy_init();
38       if(curl) {
39         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
40         curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
41
42         curl_easy_perform(curl);
43
44         /* always cleanup */
45         curl_easy_cleanup(curl);
46       }
47

AVAILABILITY

49       Added in 7.60.0
50

RETURN VALUE

52       CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
53

SEE ALSO

55       CURLOPT_DNS_CACHE_TIMEOUT(3), CURLOPT_IPRESOLVE(3),
56
57
58
59libcurl 7.85.0                   May 17, 2022 CURLOPT_DNS_SHUFFLE_ADDRESSES(3)
Impressum