Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

dns/net: net.connect() only tries the first IP address found for a host #4168

@tomlanyon

Description

@tomlanyon

Common application behaviour when connecting to a remote host is to lookup that host in DNS (getaddrinfo) and then loop through the list of addresses returned to attempt to connect to one.

In node, net.connect() calls dns.lookup() which only ever returns the first A or AAAA address for the specified host. This causes horrible problems when trying to connect to a host which returns both A and AAAA addresses when the client only has IPv4 or IPv6 (not both) connectivity; worse still, this can be inconsistent as the return order of getaddrinfo can be arbitrary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions