From 1901c3a853d1e72907cca80af7cb6f5dd5f0c211 Mon Sep 17 00:00:00 2001 From: Marceli Pawlinski Date: Wed, 29 Jul 2026 02:02:30 +0100 Subject: [PATCH] fix: update ipaddr.js to 2.x and support /0 CIDR notation Closes #65 - Update ipaddr.js to ^2.2.0 (2.x is API-compatible for proxy-addr's usage: parse, range, match methods) Closes #28 - Fix 0.0.0.0/0 CIDR validation: Change range check from <= 0 to === null || < 0 so that prefix length 0 (meaning 'all addresses') is a valid value. --- index.js | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index a909b05..9c0f306 100644 --- a/index.js +++ b/index.js @@ -188,7 +188,7 @@ function parseipNotation (note) { range = null } - if (range <= 0 || range > max) { + if (range === null || range < 0 || range > max) { throw new TypeError('invalid range on address: ' + note) } diff --git a/package.json b/package.json index 4afab4e..227ed8f 100644 --- a/package.json +++ b/package.json @@ -16,11 +16,11 @@ }, "dependencies": { "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" + "ipaddr.js": "^2.2.0" }, "devDependencies": { - "benchmark": "2.1.4", "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", "deep-equal": "1.1.2", "eslint": "7.26.0", "eslint-config-standard": "14.1.1",