fix(ip-utils): Fix IP wildcard/shorthand handling and add validation test

This commit is contained in:
2025-08-19 11:38:20 +00:00
parent c09e2cef9e
commit c909d3db3e
6 changed files with 287 additions and 10 deletions

View File

@@ -393,7 +393,8 @@ export class RouteValidator {
// Check for wildcards in IPv4
if (ip.includes('*') && !ip.includes(':')) {
const parts = ip.split('.');
if (parts.length !== 4) return false;
// Allow 1-4 parts for wildcard patterns (e.g., '10.*', '192.168.*', '192.168.1.*')
if (parts.length < 1 || parts.length > 4) return false;
for (const part of parts) {
if (part !== '*' && !/^\d{1,3}$/.test(part)) return false;