net: skip IPv6 regex when the string has no colon · nodejs/node@995a67a · GitHub
Skip to content

Commit 995a67a

Browse files
anonrigaduh95
authored andcommitted
net: skip IPv6 regex when the string has no colon
IPv6 addresses always contain ':'. Reject IPv4 addresses and hostnames before running the IPv6 regular expression. Official benchmark/net/net-is-ip-v6.js is about 27% faster. net-is-ip-v4.js is unchanged. Assisted-by: a closed-source coding agent Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com> Co-authored-by: Yagiz Nizipli <anonrig@users.noreply.github.com> PR-URL: #66165 Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 0f0892e commit 995a67a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎lib/internal/net.js‎

Lines changed: 6 additions & 0 deletions

0 commit comments

Comments
 (0)