const _get = require('lodash/get');
const DEFAULT_USER_IP = '127.0.0.1';

module.exports = req =>
    _get(req, 'tvm.ip') ||
    _get(req, 'context.auth.x-user-ip') ||
    req.ip ||
    _get(req, 'connection.remoteAddress') ||
    DEFAULT_USER_IP;
