stunnel / static-curl

static builds cURL with HTTP3
MIT License
198 stars 28 forks source link

curl 8.7.1: --dns-ipv6-addr and --dns-ipv4-addr options #72

Closed nfn closed 3 months ago

nfn commented 4 months ago

Hi

Using curl 7.76.1 from Alma Linux 9.4 I'm able to set the IPv4 and IPv6 DNS, but with curl 8.7.1 from this repo, it shows the following results:

curl --dns-ipv4-addr 1.1.1.1 --dns-ipv6-addr 2606:4700:4700::1111 --compressed -k -m 10 -X GET https://example.com curl: (6) Could not resolve host: example.com

Thanks

travislee89 commented 3 months ago

I have reproduced it here as well. The results are still different on different servers, some resolve DNS properly using only --dns-ipv4-addr, some need to use --dns-ipv6-addr. But using --dns-servers are all fine.

curl --dns-servers 1.1.1.1 --dns-servers 2606:4700:4700::1111 \
--compressed -m 10 \
-v -s -o /dev/null \
-X GET https://example.com

I'll check what --dns-ipv4-addr and --dns-ipv6-addr are about.

nfn commented 3 months ago

Hi

My example is not good since I used CF dns servers, but --dns-ipv4-addr and --dns-ipv6-addr binds the request to a specific ip address.

Thanks

travislee89 commented 3 months ago

Yeah, I checked the docs and it says that --dns-ipv4-addr and --dns-ipv6-addr are used to bind the local ip addresses.

You can check whether these commands were executed correctly.

ping -c 4 -I [local IPv4 address] [your dns server IPv4]
ping -c 4 -I [local IPv6 address] [your dns server IPv6]

dig -b [local IPv4 address] @[your dns server IPv4] example.com
dig -b [local IPv6 address] @[your dns server IPv6] example.com