diff --git a/constants.ts b/constants.ts index fec8912..f747ab3 100644 --- a/constants.ts +++ b/constants.ts @@ -39,11 +39,30 @@ export const CONSTANTS = { REGEX_LOOPBACK: new RegExp( "^" + - "(?:(?:10|127)(?:\\.\\d{1,3}){3})" + + // Loopback: 127.0.0.0 - 127.255.255.255 + "(?:127(?:\\.\\d{1,3}){3})" + "|" + - "(?:(?:169\\.254|192\\.168|192\\.0)(?:\\.\\d{1,3}){2})" + + // Private Class A: 10.0.0.0 - 10.255.255.255 + "(?:10(?:\\.\\d{1,3}){3})" + "|" + + // Private Class B: 172.16.0.0 - 172.31.255.255 "(?:172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" + + "|" + + // Private Class C: 192.168.0.0 - 192.168.255.255 + "(?:192\\.168(?:\\.\\d{1,3}){2})" + + "|" + + // Link-local: 169.254.0.0 - 169.254.255.255 + "(?:169\\.254(?:\\.\\d{1,3}){2})" + + "|" + + // Documentation: 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 + "(?:192\\.0\\.2(?:\\.\\d{1,3}){1})" + + "|" + + "(?:198\\.51\\.100(?:\\.\\d{1,3}){1})" + + "|" + + "(?:203\\.0\\.113(?:\\.\\d{1,3}){1})" + + "|" + + // Carrier-Grade NAT (CGNAT): 100.64.0.0 - 100.127.255.255 + "(?:100\\.(?:6[4-9]|[7-9]\\d|1[0-1]\\d)(?:\\.\\d{1,3}){2})" + "$", "i" ), diff --git a/jest.config.js b/jest.config.js index 457849c..7b146d3 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,4 +2,5 @@ module.exports = { preset: `ts-jest`, testEnvironment: `node`, globals: { "ts-jest": { diagnostics: false } }, + testPathIgnorePatterns: ["/build/"], };