Showing
1 changed file
with
16 additions
and
8 deletions
@@ -13,16 +13,23 @@ const captchaPolicy = require('./policies/captcha'); | @@ -13,16 +13,23 @@ const captchaPolicy = require('./policies/captcha'); | ||
13 | // const reporterPolicy = require('./policies/reporter'); | 13 | // const reporterPolicy = require('./policies/reporter'); |
14 | 14 | ||
15 | const IP_WHITE_LIST = [ | 15 | const IP_WHITE_LIST = [ |
16 | - '106.38.38.146', | ||
17 | - '106.38.38.147', | ||
18 | - '106.39.86.227', | ||
19 | - '218.94.75.58', | ||
20 | - '218.94.75.50', | ||
21 | - '218.94.77.166', | 16 | + '106.38.38.146', // 北京办公区域 |
17 | + '106.38.38.147', // 北京办公区域 | ||
18 | + '106.39.86.227', // 北京办公区域 | ||
19 | + '218.94.75.58', // 南京办公区域 | ||
20 | + '218.94.75.50', // 南京办公区域 | ||
21 | + '218.94.77.166', // 南京办公区域 | ||
22 | '10.66.70.21', // 联盟 生产 IP | 22 | '10.66.70.21', // 联盟 生产 IP |
23 | - '222.73.196.18' // B站合作方单击次数快加白名单 | 23 | + '222.73.196.18', // B站合作方单击次数快加白名单 |
24 | + '123.206.73.107', // 腾讯云出口IP | ||
25 | + '139.199.35.21', // 腾讯云出口IP | ||
26 | + '139.199.29.44', // 腾讯云出口IP | ||
27 | + '123.206.21.19' // 腾讯云出口IP | ||
24 | ]; | 28 | ]; |
25 | - | 29 | +const IP_WHITE_SEGMENT = { |
30 | + '10.66.', // 内网IP段 | ||
31 | + '192.168.' // 内网IP段 | ||
32 | +}; | ||
26 | const PATH_WHITE_LIST = [ | 33 | const PATH_WHITE_LIST = [ |
27 | '/3party/check', | 34 | '/3party/check', |
28 | '/3party/check/submit', | 35 | '/3party/check/submit', |
@@ -57,6 +64,7 @@ module.exports = (req, res, next) => { | @@ -57,6 +64,7 @@ module.exports = (req, res, next) => { | ||
57 | 64 | ||
58 | // 排除条件:ip白名单/路径白名单/异步请求/登录用户 | 65 | // 排除条件:ip白名单/路径白名单/异步请求/登录用户 |
59 | const excluded = _.includes(IP_WHITE_LIST, remoteIp) || | 66 | const excluded = _.includes(IP_WHITE_LIST, remoteIp) || |
67 | + _.includes(IP_WHITE_SEGMENT, `${remoteIp.split('.').slice(0, 2).join('.')}.`) || | ||
60 | _.includes(PATH_WHITE_LIST, req.path) || req.xhr || !_.isEmpty(_.get(req, 'user.uid')); | 68 | _.includes(PATH_WHITE_LIST, req.path) || req.xhr || !_.isEmpty(_.get(req, 'user.uid')); |
61 | const enabled = !_.get(req.app.locals, 'wap.sys.noLimiter'); | 69 | const enabled = !_.get(req.app.locals, 'wap.sys.noLimiter'); |
62 | 70 |
-
Please register or login to post a comment