1CURLOPT_DNS_INTERFACE(3) curl_easy_setopt options CURLOPT_DNS_INTERFACE(3)
2
3
4
6 CURLOPT_DNS_INTERFACE - interface to speak DNS over
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_INTERFACE, char *ifname);
12
14 Pass a char * as parameter. Set the name of the network interface that
15 the DNS resolver should bind to. This must be an interface name (not an
16 address). Set this option to NULL to use the default setting (do not
17 bind to a specific interface).
18
19 The application does not have to keep the string around after setting
20 this option.
21
23 NULL
24
26 All protocols except file:// - protocols that resolve host names.
27
29 CURL *curl = curl_easy_init();
30 if(curl) {
31 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
32 curl_easy_setopt(curl, CURLOPT_DNS_INTERFACE, "eth0");
33 ret = curl_easy_perform(curl);
34 curl_easy_cleanup(curl);
35 }
36
38 Added in 7.33.0. This option also requires that libcurl was built with
39 a resolver backend that supports this operation. The c-ares backend is
40 the only such one.
41
43 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
44 not, or CURLE_NOT_BUILT_IN if support was disabled at compile-time.
45
47 CURLOPT_DNS_SERVERS(3), CURLOPT_DNS_LOCAL_IP4(3),
48
49
50
51libcurl 8.0.1 January 02, 2023 CURLOPT_DNS_INTERFACE(3)