UNPKG

dos-protect

Version:

DOS Protector for NPM

42 lines (28 loc) 1.21 kB
# dos-protect ## _Protect your Server from dos-attack_ dos-protect will protect your server from dos-attack - To get started install the package by npm install dos-protect@latest - Use it by the function : authenticateV1 > Response code is sent: 200 for success and 429 for multiple request > Sample Code var protect=require('dos-protect');<br /> var a=protect.authenticateV2('10.10.10.10',5,10); // Here 10.10.10.10 is IP Address, 5 is Max number of hits a API can take in specific timeAllowed(timeframe) , 10 is the timeAllowed(timeframe). You Can leave it blank in which case it will default to 5 hits in 5 seconds max. <br /> if(a.status=='200){ //Success }<br /> else{ //Error } > Sample Code (Old) var protect=require('dos-protect');<br /> var a=protect.authenticateV1('10.10.10.10');<br /> if(a.status=='200){ //Success }<br /> else{ //Error } ## Installation dos-protect requires [Node.js](https://nodejs.org/) v6+ to run. dos-protect requires lodash and momentjs library. Install the dependencies and devDependencies and start the server. ```sh npm install dos-protect@latest ``` ## License MIT By Team EDII If you have any questions send us a mail at contact+dev@edii.in **Free Software**