11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst net = require('net'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst v4 = [ 71cb0ef41Sopenharmony_ci '0.0.0.0', 81cb0ef41Sopenharmony_ci '8.8.8.8', 91cb0ef41Sopenharmony_ci '127.0.0.1', 101cb0ef41Sopenharmony_ci '100.100.100.100', 111cb0ef41Sopenharmony_ci '192.168.0.1', 121cb0ef41Sopenharmony_ci '18.101.25.153', 131cb0ef41Sopenharmony_ci '123.23.34.2', 141cb0ef41Sopenharmony_ci '172.26.168.134', 151cb0ef41Sopenharmony_ci '212.58.241.131', 161cb0ef41Sopenharmony_ci '128.0.0.0', 171cb0ef41Sopenharmony_ci '23.71.254.72', 181cb0ef41Sopenharmony_ci '223.255.255.255', 191cb0ef41Sopenharmony_ci '192.0.2.235', 201cb0ef41Sopenharmony_ci '99.198.122.146', 211cb0ef41Sopenharmony_ci '46.51.197.88', 221cb0ef41Sopenharmony_ci '173.194.34.134', 231cb0ef41Sopenharmony_ci]; 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ciconst v4not = [ 261cb0ef41Sopenharmony_ci '.100.100.100.100', 271cb0ef41Sopenharmony_ci '100..100.100.100.', 281cb0ef41Sopenharmony_ci '100.100.100.100.', 291cb0ef41Sopenharmony_ci '999.999.999.999', 301cb0ef41Sopenharmony_ci '256.256.256.256', 311cb0ef41Sopenharmony_ci '256.100.100.100.100', 321cb0ef41Sopenharmony_ci '123.123.123', 331cb0ef41Sopenharmony_ci 'http://123.123.123', 341cb0ef41Sopenharmony_ci '1000.2.3.4', 351cb0ef41Sopenharmony_ci '999.2.3.4', 361cb0ef41Sopenharmony_ci '0000000192.168.0.200', 371cb0ef41Sopenharmony_ci '192.168.0.2000000000', 381cb0ef41Sopenharmony_ci]; 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_cifor (const ip of v4) { 411cb0ef41Sopenharmony_ci assert.strictEqual(net.isIPv4(ip), true); 421cb0ef41Sopenharmony_ci} 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_cifor (const ip of v4not) { 451cb0ef41Sopenharmony_ci assert.strictEqual(net.isIPv4(ip), false); 461cb0ef41Sopenharmony_ci} 47