mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
dns: tweak regex for IPv6 addresses
The regex used in `dns.setServers()` to match IPv6 addresses in square brackets uses a capturing group for the port but this info is not needed. This commit replaces the capturing group with a non capturing one. PR-URL: https://github.com/nodejs/node/pull/8665 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
committed by
Ilkka Myller
parent
4d958725b4
commit
575077ae12
@@ -293,7 +293,7 @@ exports.setServers = function(servers) {
|
||||
if (ipVersion !== 0)
|
||||
return newSet.push([ipVersion, serv]);
|
||||
|
||||
const match = serv.match(/\[(.*)\](:\d+)?/);
|
||||
const match = serv.match(/\[(.*)\](?::\d+)?/);
|
||||
// we have an IPv6 in brackets
|
||||
if (match) {
|
||||
ipVersion = isIP(match[1]);
|
||||
|
||||
Reference in New Issue
Block a user