GNURLOPT_D..._ADDRESSES(3)
π
GNURLOPT_D..._ADDRESSES(3) β CURLOPT_DNS_SHUFFLE_ADDRESSES π
okay so bestie, this is a page from the curl_easy_setopt options corner of the gnurl manual, and it's genuinely one of the slayest little flags ever. like, it's short, it's chaotic, it's giving "shuffle button on your Spotify" but for IP addresses. iykyk. π
β¨ NAME β¨
CURLOPT_DNS_SHUFFLE_ADDRESSES β Shuffle addresses when a hostname returns more than one π
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SHUFFLE_ADDRESSES, long onoff);
π DESCRIPTION π
So here's the tea β: when a name gets resolved and more than one IP address comes back, this option shuffles the order of all the returned addresses so they get used in a random order. literally just β¨randomizedβ¨. This is similar to the ordering behavior of gethostbyname which is no longer used on most platforms (rip bozo π).
Important vibe check: addresses will not be reshuffled if a name resolution is completed using the DNS cache. no cap. CURLOPT_DNS_CACHE_TIMEOUT(3) can be used together with this option to reduce the DNS cache timeout or disable caching entirely if frequent reshuffling is needed. (so if you want constant chaos, turn the cache down or off, bestie π«Ά)
And since the addresses returned will be reordered randomly, their order will not be in accordance with RFC 3484 or any other deterministic order that may be generated by the system's name resolution implementation. π This may have performance impacts and may cause IPv4 to be used before IPv6 or vice versa. so like, it's iconic but it's also a little unhinged, and the performance is lowkey affected. not me warning you twice π
π DEFAULT π
0 (disabled) β the shuffle is off until you say otherwise, queen π
πΈ PROTOCOLS πΈ
All π―
π₯ EXAMPLE π₯
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
look at her go π§ she's shuffling! she's performing! she's cleaning up after herself because she's a responsible main character β¨
π¦ AVAILABILITY π¦
Added in 7.60.0 β so she's been serving looks since 2018, periodt π
β RETURN VALUE β
CURLE_OK or an error such as CURLE_UNKNOWN_OPTION. π
(so like, either it slays or it tells you the option was unknown. either way, no mystery.)
π SEE ALSO π
okay that's the whole page, bestie!! now go forth and shuffle responsibly πΈβ¨
libcurl 7.60.0 Β· 3 March 2018 π mwah, love u, bye π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms