Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/wa.picotech.app/public_html/node_modules/validator/es/lib/ drwxr-xr-x |
Viewing file: Select action/file-type: import assertString from './util/assertString'; import isIP from './isIP'; var subnetMaybe = /^\d{1,3}$/; var v4Subnet = 32; var v6Subnet = 128; export default function isIPRange(str) { var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; assertString(str); var parts = str.split('/'); // parts[0] -> ip, parts[1] -> subnet if (parts.length !== 2) { return false; } if (!subnetMaybe.test(parts[1])) { return false; } // Disallow preceding 0 i.e. 01, 02, ... if (parts[1].length > 1 && parts[1].startsWith('0')) { return false; } var isValidIP = isIP(parts[0], version); if (!isValidIP) { return false; } // Define valid subnet according to IP's version var expectedSubnet = null; switch (String(version)) { case '4': expectedSubnet = v4Subnet; break; case '6': expectedSubnet = v6Subnet; break; default: expectedSubnet = isIP(parts[0], '6') ? v6Subnet : v4Subnet; } return parts[1] <= expectedSubnet && parts[1] >= 0; } |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.003 ]-- |