...
|
...
|
@@ -5,6 +5,7 @@ const logger = global.yoho.logger; |
|
|
const ip = require('./rules/ip-list');
|
|
|
const userAgent = require('./rules/useragent');
|
|
|
const ipWhiteList = require('./rules/ip-white-list');
|
|
|
const pathWhiteList = require('./rules/path-white-list');
|
|
|
const qpsLimiter = require('./rules/qps-limit');
|
|
|
const co = Promise.coroutine;
|
|
|
|
...
|
...
|
@@ -32,31 +33,6 @@ const IP_WHITE_SEGMENT = [ |
|
|
'10.66.', // 内网IP段
|
|
|
'192.168.' // 内网IP段
|
|
|
];
|
|
|
const PATH_WHITE_LIST = [
|
|
|
'/3party/check',
|
|
|
'/3party/check/submit',
|
|
|
'/passport/captcha/get',
|
|
|
'/passport/img-check.jpg',
|
|
|
'/passport/geetest/register',
|
|
|
'/activity/individuation',
|
|
|
'/activity/individuation/coupon',
|
|
|
'/activity/share',
|
|
|
'/activity/wechat/share',
|
|
|
'/activity/wechat/1111',
|
|
|
'/api/switch',
|
|
|
'/passport/login/user',
|
|
|
'/sw.js',
|
|
|
'/manifest.json',
|
|
|
'/activity/sw.js',
|
|
|
'/activity/manifest.json',
|
|
|
'/hfxRaNY27L.txt',
|
|
|
'/activity/hfxRaNY27L.txt',
|
|
|
'/product/shop/hfxRaNY27L.txt',
|
|
|
'/product/hfxRaNY27L.txt',
|
|
|
'/.well-known/apple-app-site-association',
|
|
|
'/service/sitemap.xml',
|
|
|
'/node/status.html'
|
|
|
];
|
|
|
|
|
|
const limiter = (rule, policy, context) => {
|
|
|
return rule(context, policy);
|
...
|
...
|
@@ -74,7 +50,7 @@ const _excluded = (req) => { |
|
|
atWhiteList ||
|
|
|
_.includes(IP_WHITE_LIST, remoteIp) ||
|
|
|
_.includes(IP_WHITE_SEGMENT, remoteIpSegment) ||
|
|
|
_.includes(PATH_WHITE_LIST, req.path) ||
|
|
|
_.includes(pathWhiteList(), req.path) ||
|
|
|
req.xhr ||
|
|
|
!_.isEmpty(_.get(req, 'user.uid'))
|
|
|
);
|
...
|
...
|
|