...
|
...
|
@@ -20,7 +20,7 @@ const limiter = (rule, policy, context) => { |
|
|
|
|
|
module.exports = (req, res, next) => {
|
|
|
let remoteIp = req.get('X-Forwarded-For') || req.connection.remoteAddress;
|
|
|
logger.info('request remote ip: ', remoteIp);
|
|
|
logger.debug('request remote ip: ', remoteIp);
|
|
|
|
|
|
if (remoteIp.indexOf(',') > 0) {
|
|
|
let arr = remoteIp.split(',');
|
...
|
...
|
@@ -44,11 +44,11 @@ module.exports = (req, res, next) => { |
|
|
limiter(userAgent, captchaPolicy, context),
|
|
|
limiter(ip, captchaPolicy, context),
|
|
|
limiter(qpsLimiter, captchaPolicy, context),
|
|
|
limiter(fakerLimiter, reporterPolicy, context)
|
|
|
//limiter(fakerLimiter, reporterPolicy, context)
|
|
|
]).then((results) => {
|
|
|
let allPass = true, exclusion = false, policy = null;
|
|
|
|
|
|
logger.info('limiter result: ' + JSON.stringify(results));
|
|
|
logger.debug('limiter result: ' + JSON.stringify(results));
|
|
|
|
|
|
_.forEach(results, (result) => {
|
|
|
if (typeof result === 'object' && !exclusion) {
|
...
|
...
|
|