Skip to content

Commit b0b1712

Browse files
committed
format
1 parent b8b6e0d commit b0b1712

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

filter/addExtStream.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@ module.exports = function(nextStream) {
88

99
function getClientIp(req) {
1010
try {
11-
var xff = (req.headers['X-Forwarded-For'] || req.headers['x-forwarded-for'] || '').split(',')[0].trim();
11+
var xff = (
12+
req.headers['X-Forwarded-For'] ||
13+
req.headers['x-forwarded-for'] ||
14+
''
15+
).split(',')[0].trim();
1216

13-
return xff ||
17+
return xff ||
1418
req.connection.remoteAddress ||
1519
req.socket.remoteAddress ||
1620
req.connection.socket.remoteAddress;
1721
} catch (ex) {
1822

1923
}
24+
2025
return "0.0.0.0";
2126
}
2227

0 commit comments

Comments
 (0)