# x-real-ip

> real client ip

Latest version **0.0.1** (published 2016-11-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install x-real-ip
pnpm add x-real-ip
yarn add x-real-ip
bun add x-real-ip
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2016-11-22 |
| First published | 2016-11-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | vinxent |

## Links

- npm: https://www.npmjs.com/package/x-real-ip
- Repository: https://github.com/vincentgor/node-request-ip
- Homepage: https://github.com/vincentgor/node-request-ip#readme
- Issues: https://github.com/vincentgor/node-request-ip/issues
- npm.io page: https://npm.io/package/x-real-ip

## Recent versions

- 0.0.1 (latest) — 2016-11-22

## README

# node-request-ip
real client ip

### what it can do
to use this, you can get the client real ip and then proxy ip list

### future
support that you can configure whether use proxy server or not

### such as an example
```js
'use strict';

var express = require('express');

var reqIP = require('x-real-ip');

var app = express();

var options = {
	real: 'r',
	forward: 'f'
};

app.use(reqIP(options));

app.get('/ip', function (req, res, next) {
	console.log(req[options.real]);
	console.log(req[options.forward]);
});

app.listen(8080);
```

### api

##### getXRealIP(req)
it will return the client real ip address
```js
var ip = getXRealIP(req);
console.log(ip);   // ::ffff:192.168.3.3
```

##### getXForwardedFor(req)
it will return the proxy ip list
```js
var ip = getXForwardedFor(req);
console.log(ip);   // ::ffff:192.168.3.3, ::ffff:192.168.3.7
```

##### mw(options)
as a middleware, it can get the both above
```js
var reqIP = require('x-real-ip');
var options = { real: 'r', forward: 'f'};
app.get('/ip', reqIP (options), function(req, res, next) {
    req[options.real];  // 
    req[options.forward]; //
});
```

`options`: attached to `req[key]`

1. `real`: real ip ,default `clientIP`.

2. `forward`: proxy ip list, default `forwardedIPList`

3. wait...

---
_Source: https://npm.io/package/x-real-ip · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
