Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redis-rate-limiter

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-rate-limiter - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

5

lib/options.js
var assert = require('assert');
var moment = require('moment');
var ip = require('ip');

@@ -40,10 +39,6 @@ exports.canonical = function(opts) {

var keyShorthands = {
'ip': function(req) {
return req.connection.remoteAddress;
},
'ip/32': function (req) {
return ip.mask(req.connection.remoteAddress, '255.255.255.0') + '/32';
}
};

21

package.json
{
"name": "redis-rate-limiter",
"version": "1.0.3",
"version": "1.0.4",
"description": "Rate-limit any operation, backed by Redis",

@@ -10,17 +10,18 @@ "author": "Tabcorp Digital Team",

"scripts": {
"test": "./node_modules/.bin/mocha"
"lint": "require-lint",
"test": "mocha"
},
"dependencies": {
"ip": "~1.1.2",
"moment": "~2.12.0"
"moment": "~2.14.1"
},
"devDependencies": {
"async": "~1.5.2",
"express": "~4.13.4",
"lodash": "~4.6.1",
"mocha": "~2.4.5",
"async": "~2.0.1",
"express": "~4.14.0",
"lodash": "~4.15.0",
"mocha": "~3.0.2",
"redis": "~2.6.0-0",
"should": "~8.3.0",
"supertest": "~1.2.0"
"require-lint": "^1.1.1",
"should": "~11.1.0",
"supertest": "~2.0.0"
}
}

@@ -73,17 +73,4 @@ # redis-rate-limiter

The key is how requests are grouped for rate-limiting.
Typically, this would be a user ID, a type of operation...
There are several helpers built-in:
Typically, this would be a user ID, a type of operation.
```js
// identify users by IP
key: 'ip'
// identify users by their IP network (255.255.255.0 mask)
key: 'ip/32'
// identify users by the X-Forwarded-For header
// careful: this is just an HTTP header and can easily be spoofed
key: 'x-forwarded-for'
```
You can also specify any custom function:

@@ -102,2 +89,8 @@

You can also use the built-in `ip` shorthand, which gets the remote address from an HTTP request.
```js
key: 'ip'
```
### `window`

@@ -188,3 +181,2 @@

);
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc