{"_id":"@aspiesoft/express-device-rate-limit","_rev":"3-2343d3f48744f54f2e858297b99b8fe2","name":"@aspiesoft/express-device-rate-limit","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@aspiesoft/express-device-rate-limit","version":"1.0.0","description":"![npm version](https://img.shields.io/npm/v/express-device-rate-limit) ![dependency status](https://img.shields.io/librariesio/release/npm/express-device-rate-limit) ![gitHub top language](https://img.shields.io/github/languages/top/aspiesoft/express-devi","main":"index.js","scripts":{"start":"export NODE_ENV=production && pm2 start index.js","test":"nodemon test/index.js","build":"node test/build.js"},"author":{"name":"AspieSoft"},"license":"MIT","keywords":["nodejs","javascript","js","express","npm","rate-limit","rate","limit","device","region","geo","location"],"dependencies":{"validator":"^13.7.0","body-parser":"^1.20.0","express-device":"^0.4.2","geoip-lite":"^1.4.5"},"devDependencies":{"express":"^4.18.1","miniforge-js":"^1.2.0","turbx":"0.0.12"},"optionalDependencies":{"body-parser":"^1.20.0","express-device":"^0.4.2","geoip-lite":"^1.4.5"},"gitHead":"b37bcc9935c248819cb3297eda47f01c3c7ba9a2","_id":"@aspiesoft/express-device-rate-limit@1.0.0","_nodeVersion":"12.22.12","_npmVersion":"6.14.16","dist":{"integrity":"sha512-1H/PeUEG2u/3ntjqF0EJm0PM8ouz7vac1HI4e4+yYl8qsp772buLKQqWz+0WIIpoYK/ldGFVPjmv8XAMuZMx8A==","shasum":"8e003df2908b3345e26d88790b1d2b0b5b9beb3e","tarball":"https://registry.npmjs.org/@aspiesoft/express-device-rate-limit/-/express-device-rate-limit-1.0.0.tgz","fileCount":4,"unpackedSize":19477,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBu0BFN7igRr0HYR+k2PRG76cy80BFegIzz9eFmdiRfqAiEAynlnXpND/ZM+74SIzkxHJostCNZaWt5yoRJA/EBUL1I="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJikRZWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqNoxAAgNbdpgTacEHuEjdCTMX5vBwgUF+ToEkyTF+RPVXETmiqSuYZ\r\nZ+6cfc7sCPwO6/egvWekA9Dy3S/OWz44cus6y5jOPSDXAlZpYWPp3eqEgpYk\r\nHzP8r09IiKWp0ANO719rpJciSLxDRamUNtNBz7yaPPBnO2fbZebkoLHQfNxZ\r\n44RhwOka+1PlQ7pwmuym3K7N3dlaFtfuEe8a6xiX+4cxofMXX6wwYgNjFvJf\r\ne+4mrHD7kT6IsAi2ZtcvP0HgSikPPhudXR4ixsolfcmzyRD4u3y03jZNj7Vj\r\nNlomtMqeAO92jwAW4N7beZApd2KMKyggxT4p+jd7RN4aeIpjKjCU1DJLgZY6\r\nZJAybXPWWq1ZWNqym6yPM6cTo8B+6+MFXtjA5p73HJD+KVLpk0qGVr29t2DS\r\ny/4jJicc1VkksA+3mjsfvWemiGNhD4WuxTNxu5qOEook+Z2wBifnoVQJ8V7y\r\nPJy3ymEbkNewF/kj6qiNeNW2JXEp1gwsZGaopXl8kjUAzbyTjpyW3+s1U/Oy\r\nVX8XgxfQ7/Hxay72dIiB6IbAP90+XuLMHsJJiLfmSSyHHUFP55Ufenoo7shR\r\nCDCFDwAejVu72Tl7SuKgT/rh+CioRlPXMlY5jVo0FjHwjFBIgyGuDooa2CUS\r\nCUBzqbrT7hsJW6Pts1IktyuS60xhoTg/m3k=\r\n=Fr4L\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-device-rate-limit_1.0.0_1653675606240_0.804831478820158"},"_hasShrinkwrap":false},"1.0.1":{"name":"@aspiesoft/express-device-rate-limit","version":"1.0.1","description":"![npm version](https://img.shields.io/npm/v/express-device-rate-limit) ![dependency status](https://img.shields.io/librariesio/release/npm/express-device-rate-limit) ![gitHub top language](https://img.shields.io/github/languages/top/aspiesoft/express-devi","main":"index.js","scripts":{"start":"export NODE_ENV=production && pm2 start index.js","test":"nodemon test/index.js","build":"node test/build.js"},"author":{"name":"AspieSoft"},"license":"MIT","keywords":["nodejs","javascript","js","express","npm","rate-limit","rate","limit","device","region","geo","location"],"dependencies":{"validator":"^13.7.0","body-parser":"^1.20.0","express-device":"^0.4.2","geoip-lite":"^1.4.5"},"devDependencies":{"express":"^4.18.1","miniforge-js":"^1.2.0","turbx":"0.0.12"},"optionalDependencies":{"body-parser":"^1.20.0","express-device":"^0.4.2","geoip-lite":"^1.4.5"},"gitHead":"bd8a2bdb317fe4b0eca9ce5ee539a109212d59c4","_id":"@aspiesoft/express-device-rate-limit@1.0.1","_nodeVersion":"12.22.12","_npmVersion":"6.14.16","dist":{"integrity":"sha512-xXrHHVZ1s8KlKCRWPZaq6YR6dwdJUWmbV45TMQc0y+JWjnHUtSCPS5CQTpceU+oT9aQC/VBEkFLmdF/WuHCvLA==","shasum":"b6f58cca68ff9ba9bec5871fef6aa786da389620","tarball":"https://registry.npmjs.org/@aspiesoft/express-device-rate-limit/-/express-device-rate-limit-1.0.1.tgz","fileCount":5,"unpackedSize":20560,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHAbbqeGRjMCRLpOyMlTYszj4Y+2XhYHAdmDP4UUWRfGAiEAih5Rp8X5hGe9h+mh3Nt0CXNCC3dlKmMShGUqt5AMCwM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJikRcMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqELxAAhpEq+XewM3vpqesHiblpTLTjfgSqh6xc3kjhVoJcKPDMUwSt\r\n/Eee1BT13daxrnZVvIiVfw29WYISBfkB2csyQNQT6pIBGxSzz8YZgn/UWKZ+\r\nUFTaTgk68PLQ4ihdgL/XXaP9Y31oRbuOs61ywnUCDLBkhYW435yRMdhv2dRP\r\n5qmuX8QLdDlkQt610ual9KEMLCFbaLEqNON55+TPhtzKEGK9XSHdVWgUAK2C\r\naKpFxgAOfexVqST/15/ooX5NJhhm+2U3mMxPx+ssEIc6Z6g/4MhBdl4EfRxP\r\nXDK66OlF+T5gen12Z2ICBuK2utcjXPU1PSD7SYe9iitjj1AxnLgiX5swh2Xq\r\nIa7i+vOeLMvN9eoYRGeFyturNKEj/IL+OGTUAWYHunyqrHflsAwHL6FpLhvb\r\n+5rvPZf6tQkUHSB9vBz7DrvlOhSv2a3OusbcRBHrUWwYI8aNzQbaJqkyxSOm\r\nuLVCyfiLKMgaeVlPmAK5RnENWGFNO842jiiWDnnqkv1EU5kLDCyu0apQ9Ur4\r\nKHDrZM8QesvfLTiBKn780gsrI5JOHx771bmWmXVB4aY+UG/rtJV8INBFu/hA\r\n9RsifXMRy6XgHc4B9mFt8AL9kPG9xso5YLqzSsC4p5sTGbbiNIKxmfrX0A3m\r\nktBMAH0bLPR0LbA8IeiNOuU5H8yoFvNjuqM=\r\n=3sii\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-device-rate-limit_1.0.1_1653675788798_0.5999626100661393"},"_hasShrinkwrap":false},"1.0.2":{"name":"@aspiesoft/express-device-rate-limit","version":"1.0.2","description":"![npm version](https://img.shields.io/npm/v/express-device-rate-limit) ![dependency status](https://img.shields.io/librariesio/release/npm/express-device-rate-limit) ![gitHub top language](https://img.shields.io/github/languages/top/aspiesoft/express-devi","main":"index.js","scripts":{"start":"export NODE_ENV=production && pm2 start index.js","test":"nodemon test/index.js","build":"node test/build.js"},"author":{"name":"AspieSoft"},"license":"MIT","keywords":["nodejs","javascript","js","express","npm","rate-limit","rate","limit","device","region","geo","location"],"dependencies":{"validator":"^13.7.0","body-parser":"^1.20.0","express-device":"^0.4.2","geoip-lite":"^1.4.5"},"devDependencies":{"express":"^4.18.1","miniforge-js":"^1.2.0","turbx":"0.5.1"},"optionalDependencies":{"body-parser":"^1.20.0","express-device":"^0.4.2","geoip-lite":"^1.4.5"},"gitHead":"bac7b6c4ff1c3870fa5f6bcc6160766c48f335dc","_id":"@aspiesoft/express-device-rate-limit@1.0.2","_nodeVersion":"12.22.12","_npmVersion":"8.19.2","dist":{"integrity":"sha512-OQAiJYUkHw8H0P92PzfwODGjlkolyPgh9vsspe1zzIVEfepAs5SukQCwkVTAUYNYhLG9r4PRwWj2xr2WLMi2MA==","shasum":"4ceb877101630ab305726c6ac1b4ae316148f01f","tarball":"https://registry.npmjs.org/@aspiesoft/express-device-rate-limit/-/express-device-rate-limit-1.0.2.tgz","fileCount":5,"unpackedSize":20559,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8ERWWJBLPCgfA4W7w7vbVtcB31URvd6Tql5WeYT1cBQIhAPGjGqzqaHs/6MD2mkNV0AmHsfYkG4uZEgMRNVhZdl5W"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjSt64ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoUpw//XAcJxqNeRVXe1A5zgt8zslCm8TMLRKF671IjGKYH4z+k61MK\r\nfrAkZIeKSKgHFSvCNtMPIK7IUtd7JDPitSCk9abEK3f+zJrH6RRiQyZ+edMf\r\n135ye4WXrVFJJ3PZw7GHFR/gnThMzGTcnFpdOS4Ez3BheiOFOyc1aS5GZlEN\r\nverDB3y08d2Z28H5sp0YsvcMyWonABiI56OyXWQkrbksDR3X2XckEPCsBdLi\r\ntFWiwxGXDWh3N21HRaI36mAXcpcx2posYl0GrdNG2wDkMdev5AnZ2Zdn+wi5\r\nrvxtyEwMQGugpeAXSGA8gLkCPykxPZUWMsJsrMUFToyhMjw6LpEYP2Llh8aM\r\np3DkM9eEc7jCtuuatzkxDKVfA8V7QT7721TgFmEXeNk8ftNXzPrP8Y4ZrmTW\r\nt3LWiHwjEjfHvcnWtcNfUcO4U93A/IuVsGm/dGHPulRLt5UuVw30r6jdIkYJ\r\nx3llbwQAEKqlFKcYMrwyUX5akw1p7TusF/ce0LSS2G9CMhdL1oHYSH0Q1FyC\r\nbOeUPwB+2uW28VCf0/U5tpPBzGwDg9WYElfggamHWU3ss9ziTUUT+UjYLygz\r\nFUudf8Q2pdnBcDqF42jKMq05h+EbaYJpjgCJ06A9J+5PkqWI0BbqLPH+f4nQ\r\nobST/xXtrJj4jF0xNSrcb+Zr0lb+rSKu8Uk=\r\n=sajU\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-device-rate-limit_1.0.2_1665851064619_0.2038317583148188"},"_hasShrinkwrap":false},"1.0.4":{"name":"@aspiesoft/express-device-rate-limit","version":"1.0.4","description":"![npm version](https://img.shields.io/npm/v/express-device-rate-limit) ![dependency status](https://img.shields.io/librariesio/release/npm/express-device-rate-limit) ![gitHub top language](https://img.shields.io/github/languages/top/aspiesoft/express-devi","main":"index.js","scripts":{"start":"export NODE_ENV=production && pm2 start index.js","test":"nodemon test/index.js","build":"node test/build.js"},"author":{"name":"AspieSoft"},"license":"MIT","keywords":["nodejs","javascript","js","express","npm","rate-limit","rate","limit","device","region","geo","location"],"dependencies":{"validator":"^13.9.0","body-parser":"^1.20.2","express-device":"^0.4.2","geoip-lite":"^1.4.7"},"devDependencies":{"express":"^4.18.2","miniforge-js":"^1.2.0","turbx":"0.5.1"},"optionalDependencies":{"body-parser":"^1.20.2","express-device":"^0.4.2","geoip-lite":"^1.4.7"},"gitHead":"51be35a8521931c6e79ac3d8fffbd4c215d46cd4","_id":"@aspiesoft/express-device-rate-limit@1.0.4","_nodeVersion":"18.16.0","_npmVersion":"9.7.1","dist":{"integrity":"sha512-AiqXJTcSSsgqMjhIbfHLzSiOUE9v37HVD2wvqy1i9BpK9SHYLLTEe5ikTzuqeY+prEHZpEmTlfjV8t0QhhiNEg==","shasum":"72892dc5aa20472c122326f2789e95a8b8b6cc29","tarball":"https://registry.npmjs.org/@aspiesoft/express-device-rate-limit/-/express-device-rate-limit-1.0.4.tgz","fileCount":5,"unpackedSize":20565,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG5K9yrmsW/QwZVhAC1eVUfYMwrbi/iW570DtQjTHyn4AiEAk+ZmJiq5Eni16QstSxr0rdyyK+sLhWujrQxUaKXWUU4="}]},"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-device-rate-limit_1.0.4_1686172899216_0.13432824553936795"},"_hasShrinkwrap":false}},"time":{"created":"2022-05-27T18:20:06.171Z","1.0.0":"2022-05-27T18:20:06.406Z","modified":"2023-06-07T21:21:39.578Z","1.0.1":"2022-05-27T18:23:08.957Z","1.0.2":"2022-10-15T16:24:24.794Z","1.0.4":"2023-06-07T21:21:39.458Z"},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"description":"![npm version](https://img.shields.io/npm/v/express-device-rate-limit) ![dependency status](https://img.shields.io/librariesio/release/npm/express-device-rate-limit) ![gitHub top language](https://img.shields.io/github/languages/top/aspiesoft/express-devi","keywords":["nodejs","javascript","js","express","npm","rate-limit","rate","limit","device","region","geo","location"],"author":{"name":"AspieSoft"},"license":"MIT","readme":"# Express Device Rate Limit\n\n![npm version](https://img.shields.io/npm/v/express-device-rate-limit)\n![dependency status](https://img.shields.io/librariesio/release/npm/express-device-rate-limit)\n![gitHub top language](https://img.shields.io/github/languages/top/aspiesoft/express-device-rate-limit)\n![npm license](https://img.shields.io/npm/l/express-device-rate-limit)\n\n![npm weekly downloads](https://img.shields.io/npm/dw/express-device-rate-limit)\n![npm monthly downloads](https://img.shields.io/npm/dm/express-device-rate-limit)\n\n[![donation link](https://img.shields.io/badge/buy%20me%20a%20coffee-square-blue)](https://buymeacoffee.aspiesoft.com)\n\nRate limiting that can be stricter on cirtain devices or geo locations.\n\n## Installation\n\n```shell script\nnpm install express-device-rate-limit\n```\n\n## Setup\n\n```js\n\nconst deviceRateLimit = require('express-device-rate-limit');\n\nconst express = require('express');\nconst app = express();\n\nconst rateLimit = deviceRateLimit({/* options */});\n\n\n// auto setup\nrateLimit.all(app);\n\n\n// manual setup\n\n// body parser pre config\napp.use(rateLimit.bodyParserUrlEncoded());\napp.use(rateLimit.bodyParserJSON());\n// or access the body-parser module directly\napp.use(rateLimit.bodyParser.urlencoded({extended: true}))\napp.use(rateLimit.bodyParser.json({type: ['json', 'application/csp-report'], limit: '1mb'}))\n\n// device.capture function\napp.use(rateLimit.deviceCapture());\n// or access the express-device module directly\napp.use(rateLimit.device.capture());\n\napp.use(rateLimit.rateLimit());\n\n```\n\n## Usage\n\n```js\n\n//node: these are the default values for these options\nconst rateLimit = deviceRateLimit({\n\n  // the number of requests that can be made by a user within a given time\n  // this is multiplied by the value of the defEffect option\n  limit: 100,\n\n  // the amount of time before reseting the recording of a users request rate\n  // s: seconds, m: minutes, h: hours, D: days, M: months, Y: years\n  time: '1m',\n\n  // the amount of time to kick a user who goes above the rate limit\n  kickTime: '1h',\n\n  // the default score to increase a user request rate by\n  defEffect: 5,\n\n  // the minimum score to increase a user request rate by\n  minEffect: 1,\n\n  // the maximum score to increase a user request rate by\n  maxEffect: this.limit * this.defEffect / 20,\n\n  // how strict should a score increase be\n  // the amount a score is increased by will be multiplied by this number\n  strict: 1,\n\n  // how passive should a score decrease be\n  // the amount a score is decreased by will be multiplied by this number\n  passive: 1,\n\n\n  // optional: handle a rate limit error in any way you want\n  err: function(req, res, next){\n    // by default this status and message is sent if a users request rate goes past the limit\n    res.status(429).send('<h1>Error 429</h1><h2>Too Many Requests</h2>').end();\n  },\n\n\n  // optional: geo location options\n  // you can increase the effect (rate score) of a user based on location\n  geo: {\n\n    // how strict should a score increase be\n    // the amount a score is increased by will be multiplied by this number\n    //note: if this number is negative, the score will be decreased\n    // a decreased score allows you to be stricter on a specific location instead\n    strict: 1,\n\n    // the below options are disabled and ignored by default\n    //note: each option is added up\n    // specifying a country and region will increase the score twice if neither apply\n\n    country: ['US'], // +4\n    region: ['NY'], // +3\n    city: ['MyCityName'], // +2\n    timezone: ['America/New_York'], // +2\n    range: [12345, 67890], // +1\n    area: 1, // +0.5\n    metro: 123, // +0.5\n\n    //note: if the geoIP module returns null, their score will be increased by +2\n  },\n});\n\n```\n","readmeFilename":"readme.md"}