Skip to content

Commit 575077a

Browse files
lpincaimyller
authored andcommitted
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: #8665 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ilkka Myller <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 4d95872 commit 575077a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/dns.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ exports.setServers = function(servers) {
293293
if (ipVersion !== 0)
294294
return newSet.push([ipVersion, serv]);
295295

296-
const match = serv.match(/\[(.*)\](:\d+)?/);
296+
const match = serv.match(/\[(.*)\](?::\d+)?/);
297297
// we have an IPv6 in brackets
298298
if (match) {
299299
ipVersion = isIP(match[1]);

0 commit comments

Comments
 (0)