Fix private IP address for IPv6
This commit is contained in:
@@ -232,7 +232,9 @@ function getPlatformImagePath(platformName) {
|
|||||||
|
|
||||||
function isPrivateIP(ip_address) {
|
function isPrivateIP(ip_address) {
|
||||||
if (ip_address.indexOf(".") > -1) {
|
if (ip_address.indexOf(".") > -1) {
|
||||||
var parts = ip_address.split('.');
|
// get IPv4 mapped address (xxx.xxx.xxx.xxx) from IPv6 addresss (::ffff:xxx.xxx.xxx.xxx)
|
||||||
|
var parts = ip_address.split(":");
|
||||||
|
var parts = parts[parts.length - 1].split('.');
|
||||||
if (parts[0] === '10' ||
|
if (parts[0] === '10' ||
|
||||||
(parts[0] === '172' && (parseInt(parts[1], 10) >= 16 && parseInt(parts[1], 10) <= 31)) ||
|
(parts[0] === '172' && (parseInt(parts[1], 10) >= 16 && parseInt(parts[1], 10) <= 31)) ||
|
||||||
(parts[0] === '192' && parts[1] === '168')) {
|
(parts[0] === '192' && parts[1] === '168')) {
|
||||||
|
Reference in New Issue
Block a user