mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
net: recognize bare IPv6 loopback addresses in isLoopback
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com> PR-URL: https://github.com/nodejs/node/pull/63619 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
20f5b0a283
commit
e06b0f1350
2 files changed
+9
-1
No files matched your search
+3
-1
@@ -94,7 +94,9 @@ function isLoopback(host) {
|
||||
hostLower === 'localhost' ||
|
||||
hostLower.startsWith('127.') ||
|
||||
hostLower === '[::1]' ||
|
||||
hostLower === '[0:0:0:0:0:0:0:1]'
|
||||
hostLower === '::1' ||
|
||||
hostLower === '[0:0:0:0:0:0:0:1]' ||
|
||||
hostLower === '0:0:0:0:0:0:0:1'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ const loopback = [
|
||||
'127.0.0.255',
|
||||
'127.1.2.3',
|
||||
'[::1]',
|
||||
'::1',
|
||||
'[0:0:0:0:0:0:0:1]',
|
||||
'0:0:0:0:0:0:0:1',
|
||||
];
|
||||
|
||||
const loopbackNot = [
|
||||
@@ -21,6 +23,10 @@ const loopbackNot = [
|
||||
'[2001:db8::1]',
|
||||
'[fe80::1]',
|
||||
'8.8.8.8',
|
||||
'::2',
|
||||
'[::2]',
|
||||
'0:0:0:0:0:0:0:2',
|
||||
'[0:0:0:0:0:0:0:2]',
|
||||
];
|
||||
|
||||
for (const address of loopback) {
|
||||
|
||||
Reference in new issue
Block a user