not-node 6.5.59 → 6.5.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/common.js +6 -3
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -342,14 +342,17 @@ module.exports.generatePaths = (content = [], relative = "src") => {
|
|
|
342
342
|
**/
|
|
343
343
|
module.exports.getIP = (req) => {
|
|
344
344
|
if (req) {
|
|
345
|
-
|
|
345
|
+
const ip =
|
|
346
346
|
(req.headers && req.headers["x-forwarded-for"]) ||
|
|
347
347
|
(req.connection && req.connection.remoteAddress) ||
|
|
348
348
|
(req.socket && req.socket.remoteAddress) ||
|
|
349
349
|
(req.connection &&
|
|
350
350
|
req.connection.socket &&
|
|
351
|
-
req.connection.socket.remoteAddress)
|
|
352
|
-
)
|
|
351
|
+
req.connection.socket.remoteAddress);
|
|
352
|
+
if (ip && ip.indexOf(",") > -1) {
|
|
353
|
+
return ip.split(",")[0];
|
|
354
|
+
}
|
|
355
|
+
return ip;
|
|
353
356
|
} else {
|
|
354
357
|
return undefined;
|
|
355
358
|
}
|