1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_DNS_LOCAL_IP4 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_DNS_INTERFACE (3) 9 - CURLOPT_DNS_LOCAL_IP6 (3) 10 - CURLOPT_DNS_SERVERS (3) 11Protocol: 12 - All 13Added-in: 7.33.0 14--- 15 16# NAME 17 18CURLOPT_DNS_LOCAL_IP4 - IPv4 address to bind DNS resolves to 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char *address); 26~~~ 27 28# DESCRIPTION 29 30Set the local IPv4 *address* that the resolver should bind to. The argument 31should be of type char * and contain a single numerical IPv4 address as a 32string. Set this option to NULL to use the default setting (do not bind to a 33specific IP address). 34 35The application does not have to keep the string around after setting this 36option. 37 38Using this option multiple times makes the last set string override the 39previous ones. Set it to NULL to disable its use again. 40 41# DEFAULT 42 43NULL 44 45# %PROTOCOLS% 46 47# EXAMPLE 48 49~~~c 50int main(void) 51{ 52 CURL *curl = curl_easy_init(); 53 if(curl) { 54 CURLcode res; 55 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 56 curl_easy_setopt(curl, CURLOPT_DNS_LOCAL_IP4, "192.168.0.14"); 57 res = curl_easy_perform(curl); 58 curl_easy_cleanup(curl); 59 } 60} 61~~~ 62 63# NOTES 64 65This option requires that libcurl was built with a resolver backend that 66supports this operation. The c-ares backend is the only such one. 67 68# %AVAILABILITY% 69 70# RETURN VALUE 71 72Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, 73CURLE_NOT_BUILT_IN if support was disabled at compile-time, or 74CURLE_BAD_FUNCTION_ARGUMENT when given a bad address. 75