...
|
...
|
@@ -7,6 +7,7 @@ |
|
|
'use strict';
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const net = require('net');
|
|
|
|
|
|
/**
|
|
|
* 获取 IP
|
...
|
...
|
@@ -25,7 +26,15 @@ const _getClientIp = req => { |
|
|
remoteIp = req.get('X-Real-IP');
|
|
|
}
|
|
|
|
|
|
return _.trim(remoteIp);
|
|
|
remoteIp = _.trim(remoteIp);
|
|
|
|
|
|
if (!net.isIPv4(remoteIp)) {
|
|
|
let ipv6String = remoteIp.split(':');
|
|
|
|
|
|
remoteIp = ipv6String[ipv6String.length - 1];
|
|
|
}
|
|
|
|
|
|
return remoteIp;
|
|
|
};
|
|
|
|
|
|
module.exports = () => {
|
...
|
...
|
|