-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dns: getServers returns IPv6 addresses without []
#13795
Comments
I just noticed this, IMHO we should format IPv6 with return ret.map(([host, port]) => {
if (isIP(host) === 6) host = `[${host}]`;
return (!port || port === 53) host : `${host}:${port}`;
} Fix will be |
I think a bare IPv6 without |
I was going by rfc3986, which is ratified while rfc5952 is still "proposed". |
rfc3986 is about URIs, which I think host:port is not (IIRC, a valid URI always requires a protocol). Anyways, If you want to treat it like an URL, you can use the legacy url module to format it (not sure if the same is possible using WHATWG URL, as it doesn't allow calling the constructor without arguments): > u = new url.Url(); u.hostname = "::1"; u.format()
'[::1]'
> u = new url.Url(); u.hostname = "::1"; u.port = 53; u.format()
'[::1]:53'
> u = new url.Url(); u.hostname = "127.0.0.1"; u.format()
'127.0.0.1'
> u = new url.Url(); u.hostname = "127.0.0.1"; u.port = 53; u.format()
'127.0.0.1:53' |
As suggested just now #13723 (comment) A |
💡 |
Declaring a DNS server like this is rather uncommon. Why not require and return
|
(again for context, I think this is of very low priority if at all, I just enjoy the discussion) Passing |
Closing as known limitation. Feel absolutely free to re-open or comment if you feel it should stay open, especially if you think it might be addressed some point in the not-too-distant future. |
dns.getServers
mis formats IPv6 addressesThe text was updated successfully, but these errors were encountered: