express-rate-limit 8.1.0 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -2
- package/dist/index.mjs +7 -2
- package/package.json +110 -111
package/dist/index.cjs
CHANGED
|
@@ -31,8 +31,13 @@ module.exports = __toCommonJS(index_exports);
|
|
|
31
31
|
var import_node_net = require("node:net");
|
|
32
32
|
var import_ip_address = require("ip-address");
|
|
33
33
|
function ipKeyGenerator(ip, ipv6Subnet = 56) {
|
|
34
|
-
if (
|
|
35
|
-
|
|
34
|
+
if ((0, import_node_net.isIPv6)(ip)) {
|
|
35
|
+
const address = new import_ip_address.Address6(ip);
|
|
36
|
+
if (address.is4()) return address.to4().correctForm();
|
|
37
|
+
if (ipv6Subnet) {
|
|
38
|
+
const subnet = new import_ip_address.Address6(`${ip}/${ipv6Subnet}`);
|
|
39
|
+
return `${subnet.startAddress().correctForm()}/${ipv6Subnet}`;
|
|
40
|
+
}
|
|
36
41
|
}
|
|
37
42
|
return ip;
|
|
38
43
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
import { isIPv6 } from "node:net";
|
|
3
3
|
import { Address6 } from "ip-address";
|
|
4
4
|
function ipKeyGenerator(ip, ipv6Subnet = 56) {
|
|
5
|
-
if (
|
|
6
|
-
|
|
5
|
+
if (isIPv6(ip)) {
|
|
6
|
+
const address = new Address6(ip);
|
|
7
|
+
if (address.is4()) return address.to4().correctForm();
|
|
8
|
+
if (ipv6Subnet) {
|
|
9
|
+
const subnet = new Address6(`${ip}/${ipv6Subnet}`);
|
|
10
|
+
return `${subnet.startAddress().correctForm()}/${ipv6Subnet}`;
|
|
11
|
+
}
|
|
7
12
|
}
|
|
8
13
|
return ip;
|
|
9
14
|
}
|
package/package.json
CHANGED
|
@@ -1,112 +1,111 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
2
|
+
"name": "express-rate-limit",
|
|
3
|
+
"version": "8.1.1",
|
|
4
|
+
"description": "Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Nathan Friedly",
|
|
7
|
+
"url": "http://nfriedly.com/"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"homepage": "https://github.com/express-rate-limit/express-rate-limit",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/express-rate-limit/express-rate-limit.git"
|
|
14
|
+
},
|
|
15
|
+
"funding": "https://github.com/sponsors/express-rate-limit",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"express-rate-limit",
|
|
18
|
+
"express",
|
|
19
|
+
"rate",
|
|
20
|
+
"limit",
|
|
21
|
+
"ratelimit",
|
|
22
|
+
"rate-limit",
|
|
23
|
+
"middleware",
|
|
24
|
+
"ip",
|
|
25
|
+
"auth",
|
|
26
|
+
"authorization",
|
|
27
|
+
"security",
|
|
28
|
+
"brute",
|
|
29
|
+
"force",
|
|
30
|
+
"bruteforce",
|
|
31
|
+
"brute-force",
|
|
32
|
+
"attack"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/index.d.mts",
|
|
39
|
+
"default": "./dist/index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/index.d.cts",
|
|
43
|
+
"default": "./dist/index.cjs"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"main": "./dist/index.cjs",
|
|
48
|
+
"module": "./dist/index.mjs",
|
|
49
|
+
"types": "./dist/index.d.ts",
|
|
50
|
+
"files": [
|
|
51
|
+
"dist/",
|
|
52
|
+
"tsconfig.json"
|
|
53
|
+
],
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">= 16"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"ip-address": "10.1.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"express": ">= 4.11"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@biomejs/biome": "2.2.2",
|
|
65
|
+
"@express-rate-limit/prettier": "1.1.1",
|
|
66
|
+
"@express-rate-limit/tsconfig": "1.0.2",
|
|
67
|
+
"@jest/globals": "30.1.2",
|
|
68
|
+
"@types/express": "5.0.3",
|
|
69
|
+
"@types/jest": "30.0.0",
|
|
70
|
+
"@types/node": "24.3.0",
|
|
71
|
+
"@types/supertest": "6.0.3",
|
|
72
|
+
"del-cli": "6.0.0",
|
|
73
|
+
"dts-bundle-generator": "8.1.2",
|
|
74
|
+
"esbuild": "0.25.9",
|
|
75
|
+
"express": "5.1.0",
|
|
76
|
+
"husky": "9.1.7",
|
|
77
|
+
"jest": "30.1.2",
|
|
78
|
+
"lint-staged": "16.1.6",
|
|
79
|
+
"mintlify": "4.2.94",
|
|
80
|
+
"npm-run-all": "4.1.5",
|
|
81
|
+
"prettier": "3.6.2",
|
|
82
|
+
"ratelimit-header-parser": "0.1.0",
|
|
83
|
+
"supertest": "7.1.4",
|
|
84
|
+
"ts-jest": "29.4.1",
|
|
85
|
+
"ts-node": "10.9.2",
|
|
86
|
+
"typescript": "5.9.2"
|
|
87
|
+
},
|
|
88
|
+
"prettier": "@express-rate-limit/prettier",
|
|
89
|
+
"lint-staged": {
|
|
90
|
+
"*.{js,ts,json}": "biome check --write",
|
|
91
|
+
"*.{md,yaml}": "prettier --write"
|
|
92
|
+
},
|
|
93
|
+
"scripts": {
|
|
94
|
+
"clean": "del-cli dist/ coverage/ *.log *.tmp *.bak *.tgz",
|
|
95
|
+
"build:cjs": "esbuild --packages=external --platform=node --bundle --target=es2022 --format=cjs --outfile=dist/index.cjs --footer:js=\"module.exports = Object.assign(rateLimit, module.exports);\" source/index.ts",
|
|
96
|
+
"build:esm": "esbuild --packages=external --platform=node --bundle --target=es2022 --format=esm --outfile=dist/index.mjs source/index.ts",
|
|
97
|
+
"build:types": "dts-bundle-generator --out-file=dist/index.d.ts source/index.ts && cp dist/index.d.ts dist/index.d.cts && cp dist/index.d.ts dist/index.d.mts",
|
|
98
|
+
"compile": "run-s clean build:*",
|
|
99
|
+
"docs": "cd docs && mintlify dev",
|
|
100
|
+
"lint:code": "biome check",
|
|
101
|
+
"lint:docs": "prettier --check docs/ *.md",
|
|
102
|
+
"lint": "run-s lint:*",
|
|
103
|
+
"format:code": "biome check --write",
|
|
104
|
+
"format:docs": "prettier --write docs/ *.md",
|
|
105
|
+
"format": "run-s format:*",
|
|
106
|
+
"test:lib": "jest",
|
|
107
|
+
"test:ext": "cd test/external/ && bash run-all-tests",
|
|
108
|
+
"test": "run-s lint test:lib",
|
|
109
|
+
"pre-commit": "lint-staged"
|
|
110
|
+
}
|
|
111
|
+
}
|