Commit 0a36bce53a1 for nodejs

commit 0a36bce53a14e0a73b1c349885ef279ec49c777c
Author: Yagiz Nizipli <yagiz@nizipli.com>
Date:   Fri Sep 25 09:59:16 2026 -0400

    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: https://github.com/nodejs/node/pull/66165
    Reviewed-By: Tim Perry <pimterry@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

diff --git a/lib/internal/net.js b/lib/internal/net.js
index 2553449f050..3c7bb7d4a95 100644
--- a/lib/internal/net.js
+++ b/lib/internal/net.js
@@ -3,6 +3,7 @@
 const {
   RegExp,
   RegExpPrototypeTest,
+  StringPrototypeIndexOf,
   Symbol,
 } = primordials;

@@ -46,6 +47,11 @@ function isIPv4(s) {
  * @returns {boolean}
  */
 function isIPv6(s) {
+  if (typeof s === 'string') {
+    // IPv6 always contains ':'. Skip the regex for IPv4 and hostnames.
+    if (s.length < 2 || StringPrototypeIndexOf(s, ':') === -1)
+      return false;
+  }
   // TODO(aduh95): Replace RegExpPrototypeTest with RegExpPrototypeExec when it
   // no longer creates a perf regression in the dns benchmark.
   // eslint-disable-next-line node-core/avoid-prototype-pollution