CURLOPT_DNS_INTERFACE.3 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. .\" generated by cd2nroff 0.1 from CURLOPT_DNS_INTERFACE.md
  2. .TH CURLOPT_DNS_INTERFACE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_DNS_INTERFACE \- interface to speak DNS over
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_INTERFACE, char *ifname);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a char pointer as parameter. Set the name of the network interface that
  12. the DNS resolver should bind to. This must be an interface name (not an
  13. address). Set this option to NULL to use the default setting (do not bind to a
  14. specific interface).
  15. The application does not have to keep the string around after setting this
  16. option.
  17. .SH DEFAULT
  18. NULL
  19. .SH PROTOCOLS
  20. This functionality affects all supported protocols
  21. .SH EXAMPLE
  22. .nf
  23. int main(void)
  24. {
  25. CURL *curl = curl_easy_init();
  26. if(curl) {
  27. CURLcode res;
  28. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  29. curl_easy_setopt(curl, CURLOPT_DNS_INTERFACE, "eth0");
  30. res = curl_easy_perform(curl);
  31. curl_easy_cleanup(curl);
  32. }
  33. }
  34. .fi
  35. .SH NOTES
  36. This option requires that libcurl was built with a resolver backend that
  37. supports this operation. The c\-ares backend is the only such one.
  38. .SH AVAILABILITY
  39. Added in curl 7.33.0
  40. .SH RETURN VALUE
  41. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not,
  42. or CURLE_NOT_BUILT_IN if support was disabled at compile\-time.
  43. .SH SEE ALSO
  44. .BR CURLOPT_DNS_LOCAL_IP4 (3),
  45. .BR CURLOPT_DNS_LOCAL_IP6 (3),
  46. .BR CURLOPT_DNS_SERVERS (3),
  47. .BR CURLOPT_INTERFACE (3)