lib/request-extractors/hapi.js
function extractRemoteAddressFromRequest(req) {

  if (has(req.headers, 'x-forwarded-for')) {

    return req.headers['x-forwarded-for'];
  } else if (isObject(req.info)) {

    return req.info.remoteAddress;
  }

  return '';
}
function extractRemoteAddressFromRequest(req) {

  if (has(req.headers, 'x-forwarded-for')) {

    return req.headers['x-forwarded-for'];
  } else if (isObject(req.info)) {

    return req.info.remoteAddress;
  }

  return '';
}
function extractRemoteAddressFromRequest ( req ) { if ( has ( req . headers , 'x-forwarded-for' ) ) { return req . headers [ 'x-forwarded-for' ] ; } else if ( isObject ( req . info ) ) { return req . info . remoteAddress ; } return '' ; }
This function is used to check for the x-forwarded-for header first to
identify source IP connnections. If this header is not present, then the
function will attempt to extract the remoteAddress from the request.info
object property. If neither of these properties can be found then an empty
string will be returned.
@function extractRemoteAddressFromRequest
@param {Object} req - the request information object to extract from
@returns {String} - Either an empty string if the IP cannot be extracted or
a string that represents the remote IP address
This function is used to check for the x - forwarded - for header first to identify source IP connnections . If this header is not present then the function will attempt to extract the remoteAddress from the request . info object property . If neither of these properties can be found then an empty string will be returned .