Skip to content

Commit 9d4b1f0

Browse files
lpincajasnell
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 <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>
1 parent 3f88692 commit 9d4b1f0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)