Matias Alejo Garcia
8 years ago
No known key found for this signature in database
GPG Key ID: 2470DB551277AB3
2 changed files with
6 additions and
6 deletions
-
lib/common/defaults.js
-
lib/expressapp.js
|
|
@ -93,10 +93,10 @@ Defaults.SESSION_EXPIRATION = 1 * 60 * 60; // 1 hour to session expiration |
|
|
|
Defaults.RateLimit = { |
|
|
|
createWallet: { |
|
|
|
windowMs: 60 * 60 * 1000, // hour window
|
|
|
|
delayAfter: 5, // begin slowing down responses after the 3rd request
|
|
|
|
delayMs: 3 * 1000, // slow down subsequent responses by 3 seconds per request
|
|
|
|
max: 20, // start blocking after 20 requests
|
|
|
|
message: "Too many accounts created from this IP, please try again after an hour" |
|
|
|
delayAfter: 10, // begin slowing down responses after the 3rd request
|
|
|
|
delayMs: 3000, // slow down subsequent responses by 3 seconds per request
|
|
|
|
max: 20, // start blocking after 20 request
|
|
|
|
message: "Too many wallets created from this IP, please try again after an hour" |
|
|
|
}, |
|
|
|
// otherPosts: {
|
|
|
|
// windowMs: 60 * 60 * 1000, // 1 hour window
|
|
|
|
|
|
@ -175,8 +175,8 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
if (Defaults.RateLimit.createWallet) { |
|
|
|
log.info('', 'Limiting wallet creation per IP: %d req/h', (Defaults.RateLimit.createWallet.max / Defaults.RateLimit.createWallet.windowMs * 60 * 60 * 1000).toFixed(2)) |
|
|
|
var createWalletLimiter = new RateLimit(Defaults.RateLimit.createWallet); |
|
|
|
router.use('/v1/wallets/', createWalletLimiter) |
|
|
|
router.use('/v2/wallets/', createWalletLimiter) |
|
|
|
router.use(/\v1\/wallets\/$/, createWalletLimiter) |
|
|
|
router.use(/\/v2\/wallets\/$/, createWalletLimiter) |
|
|
|
} |
|
|
|
|
|
|
|
// DEPRECATED
|
|
|
|