finalchild opened a new pull request, #479:
URL: https://github.com/apache/cassandra-nodejs-driver/pull/479
## Summary
- Resolve contact-point hostnames through the operating system resolver with
`dns.lookup(name, { all: true })`.
- Preserve every IPv4 and IPv6 result and the configured contact-point port.
- Add regression coverage for multiple addresses, both address families,
lookup failures, empty results, custom ports, and re-resolution.
## Motivation
The current implementation uses `dns.resolve4()` and `dns.resolve6()`, which
query DNS through c-ares rather than following the operating system's complete
name-resolution policy. This can bypass hosts files, NSS, Windows
name-resolution policy, VPN and split-DNS configuration, and resolvers such as
Tailscale MagicDNS.
The direct-DNS implementation was introduced in #147 when this driver
supported Node.js 0.10. The driver now requires Node.js 20 or newer, where
`dns.lookup()` supports `{ all: true }`, so using the system resolver no longer
requires sacrificing multi-address discovery.
This also follows the approach used by other official Cassandra drivers:
- Java resolves all addresses with `InetAddress.getAllByName()` in
`AddressUtils.extract()`.
- Python resolves contact points with `socket.getaddrinfo(..., AF_UNSPEC,
SOCK_STREAM)`.
- C++ uses `uv_getaddrinfo()` with `AF_UNSPEC` and iterates every result.
## Verification
- Full unit suite on Node.js 22: 1,351 passing, 1 pending
- Focused control-connection tests on Node.js 20, 22, and 24: 19 passing on
each
- ESLint passes for both modified files
- `git diff --check` passes
## References
- Jira: https://issues.apache.org/jira/browse/CASSNODEJS-16
- Original resolver PR:
https://github.com/apache/cassandra-nodejs-driver/pull/147
- Node.js DNS documentation:
https://nodejs.org/api/dns.html#dnslookuphostname-options-callback
- Java driver:
https://github.com/apache/cassandra-java-driver/blob/trunk/core/src/main/java/com/datastax/oss/driver/internal/core/util/AddressUtils.java
- Python driver:
https://github.com/apache/cassandra-python-driver/blob/trunk/cassandra/cluster.py
- C++ driver:
https://github.com/apache/cassandra-cpp-driver/blob/trunk/src/resolver.hpp
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]