rate-limiter-flexible
Advanced tools
Comparing version 5.0.2 to 5.0.3
{ | ||
"name": "rate-limiter-flexible", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Node.js rate limiter by key and protection from DDoS and Brute-Force attacks in process Memory, Redis, MongoDb, Memcached, MySQL, PostgreSQL, Cluster or PM", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,7 +13,7 @@ [![npm version](https://badge.fury.io/js/rate-limiter-flexible.svg)](https://www.npmjs.com/package/rate-limiter-flexible) | ||
**rate-limiter-flexible** counts and limits number of actions by key and protects from DDoS and brute force attacks at any scale. | ||
**rate-limiter-flexible** counts and limits the number of actions by key and protects from DDoS and brute force attacks at any scale. | ||
It works with _Redis_, _Prisma_, _DynamoDB_, process _Memory_, _Cluster_ or _PM2_, _Memcached_, _MongoDB_, _MySQL_, _PostgreSQL. | ||
It works with _Redis_, _Prisma_, _DynamoDB_, process _Memory_, _Cluster_ or _PM2_, _Memcached_, _MongoDB_, _MySQL_, and _PostgreSQL_. | ||
Memory limiter also works in browser. | ||
Memory limiter also works in the browser. | ||
@@ -26,7 +26,7 @@ **Atomic increments.** All operations in memory or distributed environment use atomic increments against race conditions. | ||
**Ready for growth.** It provides unified API for all limiters. Whenever your application grows, it is ready. Prepare your limiters in minutes. | ||
**Ready for growth.** It provides a unified API for all limiters. Whenever your application grows, it is ready. Prepare your limiters in minutes. | ||
**Friendly.** No matter which node package you prefer: `redis` or `ioredis`, `sequelize`/`typeorm` or `knex`, `memcached`, native driver or `mongoose`. It works with all of them. | ||
**In memory blocks.** Avoid extra requests to store with [inMemoryBlockOnConsumed](https://github.com/animir/node-rate-limiter-flexible/wiki/Options#inmemoryblockonconsumed). | ||
**In-memory blocks.** Avoid extra requests to store with [inMemoryBlockOnConsumed](https://github.com/animir/node-rate-limiter-flexible/wiki/Options#inmemoryblockonconsumed). | ||
@@ -37,3 +37,3 @@ Allow **traffic bursts** with [BurstyRateLimiter](https://github.com/animir/node-rate-limiter-flexible/wiki/BurstyRateLimiter). | ||
It uses **fixed window** as it is much faster than rolling window. | ||
It uses a **fixed window**, as it is much faster than a rolling window. | ||
[See comparative benchmarks with other libraries here](https://github.com/animir/node-rate-limiter-flexible/wiki/Comparative-benchmarks) | ||
@@ -84,3 +84,3 @@ | ||
Both Promise resolve and reject return object of `RateLimiterRes` class if there is no any error. | ||
The Promise's `resolve` and `reject` callbacks both return an instance of the `RateLimiterRes` class if there is no error. | ||
Object attributes: | ||
@@ -96,3 +96,3 @@ ```javascript | ||
You may want to set next HTTP headers to response: | ||
You may want to set HTTP headers for the response: | ||
```javascript | ||
@@ -112,3 +112,3 @@ const headers = { | ||
* Block Strategy against really powerful DDoS attacks (like 100k requests per sec) [Read about it and benchmarking here](https://github.com/animir/node-rate-limiter-flexible/wiki/In-memory-Block-Strategy) | ||
* Insurance Strategy as emergency solution if database / store is down [Read about Insurance Strategy here](https://github.com/animir/node-rate-limiter-flexible/wiki/Insurance-Strategy) | ||
* Insurance Strategy as emergency solution if database/store is down [Read about Insurance Strategy here](https://github.com/animir/node-rate-limiter-flexible/wiki/Insurance-Strategy) | ||
* works in Cluster or PM2 without additional software [See RateLimiterCluster benchmark and detailed description here](https://github.com/animir/node-rate-limiter-flexible/wiki/Cluster) | ||
@@ -170,3 +170,3 @@ * useful `get`, `set`, `block`, `delete`, `penalty` and `reward` methods | ||
Maximum number of points can be consumed over duration | ||
Maximum number of points that can be consumed over duration | ||
@@ -179,3 +179,3 @@ * **duration** | ||
Never reset points, if `duration` is set to 0. | ||
Points are never reset if `duration` is set to 0. | ||
@@ -186,3 +186,3 @@ * **storeClient** | ||
Have to be `redis`, `ioredis`, `memcached`, `mongodb`, `pg`, `mysql2`, `mysql` or any other related pool or connection. | ||
Must be `redis`, `ioredis`, `memcached`, `mongodb`, `pg`, `mysql2`, `mysql` or any other related pool or connection. | ||
@@ -201,3 +201,3 @@ ### Other options on Wiki: | ||
Smooth out traffic picks: | ||
Smooth out traffic peaks: | ||
* [execEvenly](https://github.com/animir/node-rate-limiter-flexible/wiki/Options#execevenly) | ||
@@ -230,3 +230,3 @@ * [execEvenlyMinDelayMs](https://github.com/animir/node-rate-limiter-flexible/wiki/Options#execevenlymindelayms) | ||
Average latency during test pure NodeJS endpoint in cluster of 4 workers with everything set up on one server. | ||
Average latency during test of pure NodeJS endpoint in cluster of 4 workers with everything set up on one server. | ||
@@ -251,3 +251,3 @@ 1000 concurrent clients with maximum 2000 requests per sec during 30 seconds. | ||
## Contribution | ||
## Contributions | ||
@@ -260,14 +260,14 @@ Appreciated, feel free! | ||
Any new limiter with storage have to be extended from `RateLimiterStoreAbstract`. | ||
Any new limiter with storage must be extended from `RateLimiterStoreAbstract`. | ||
It has to implement 4 methods: | ||
* `_getRateLimiterRes` parses raw data from store to `RateLimiterRes` object. | ||
* `_upsert` may be atomic or non-atomic upsert (increment). It inserts or updates value by key and returns raw data. | ||
If it doesn't make atomic upsert (increment), the class should be suffixed with `NonAtomic`, e.g. `RateLimiterRedisNonAtomic`. | ||
* `_upsert` may be atomic or non-atomic upsert (increment). It inserts or updates the value by key and returns raw data. | ||
If it doesn't make an atomic upsert (increment), the class should be suffixed with `NonAtomic`, e.g. `RateLimiterRedisNonAtomic`. | ||
It must support `forceExpire` mode to overwrite key expiration time. | ||
* `_get` returns raw data by key or `null` if there is no key. | ||
* `_delete` deletes all key related data and returns `true` on deleted, `false` if key is not found. | ||
* `_delete` deletes all key-related data and returns `true` on deleted, `false` if key is not found. | ||
All other methods depends on store. See `RateLimiterRedis` or `RateLimiterPostgres` for example. | ||
All other methods depends on the store. See `RateLimiterRedis` or `RateLimiterPostgres` for examples. | ||
Note: all changes should be covered by tests. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141220