• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_DNS_LOCAL_IP6
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_DNS_INTERFACE (3)
9  - CURLOPT_DNS_LOCAL_IP4 (3)
10  - CURLOPT_DNS_SERVERS (3)
11Protocol:
12  - All
13Added-in: 7.33.0
14---
15
16# NAME
17
18CURLOPT_DNS_LOCAL_IP6 - IPv6 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_IP6, char *address);
26~~~
27
28# DESCRIPTION
29
30Set the local IPv6 *address* that the resolver should bind to. The argument
31should be of type char * and contain a single IPv6 address as a string. Set
32this option to NULL to use the default setting (do not bind to a specific IP
33address).
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_IP6, "fe80::a9ff:fe46:b619");
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
72curl_easy_setopt(3) returns a CURLcode indicating success or error.
73
74CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
75libcurl-errors(3).
76