In node.js 4.x for the function http.request
the docs say
Options
- family: IP address family to use when resolving host and hostname. Valid values are 4 or 6. When unspecified, both IP v4 and v6 will be used.
What is the logic behind when node.js will choose ipv6 or ipv4 when family
is not specified?
As far as I can tell when I don't specify it it defaults to or prefers ipv4 whereas browsers, at least, chrome, prefers ipv6
Is there a way to get node.js to choose ipv6 when available or do I have to do with manually?
If I was to do it manually what should do?
pass in
family: 6
, if timeout then pass infamily: 4
?Make a DNS request and check if I get an ipv6 address back, then set the family?