Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
loskael committed Nov 10, 2015
1 parent b8b6e0d commit b0b1712
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions filter/addExtStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ module.exports = function(nextStream) {

function getClientIp(req) {
try {
var xff = (req.headers['X-Forwarded-For'] || req.headers['x-forwarded-for'] || '').split(',')[0].trim();
var xff = (
req.headers['X-Forwarded-For'] ||
req.headers['x-forwarded-for'] ||
''
).split(',')[0].trim();

return xff ||
return xff ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||
req.connection.socket.remoteAddress;
} catch (ex) {

}

return "0.0.0.0";
}

Expand Down

0 comments on commit b0b1712

Please sign in to comment.