update
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
1.0.1 / 2021-11-14
|
||||
==================
|
||||
|
||||
* pref: enable strict mode
|
||||
|
||||
1.0.0 / 2018-07-09
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
@@ -0,0 +1,57 @@
|
||||
# forwarded
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][ci-image]][ci-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Parse HTTP X-Forwarded-For header
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install forwarded
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var forwarded = require('forwarded')
|
||||
```
|
||||
|
||||
### forwarded(req)
|
||||
|
||||
```js
|
||||
var addresses = forwarded(req)
|
||||
```
|
||||
|
||||
Parse the `X-Forwarded-For` header from the request. Returns an array
|
||||
of the addresses, including the socket address for the `req`, in reverse
|
||||
order (i.e. index `0` is the socket address and the last index is the
|
||||
furthest address, typically the end-user).
|
||||
|
||||
## Testing
|
||||
|
||||
```sh
|
||||
$ npm test
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[ci-image]: https://badgen.net/github/checks/jshttp/forwarded/master?label=ci
|
||||
[ci-url]: https://github.com/jshttp/forwarded/actions?query=workflow%3Aci
|
||||
[npm-image]: https://img.shields.io/npm/v/forwarded.svg
|
||||
[npm-url]: https://npmjs.org/package/forwarded
|
||||
[node-version-image]: https://img.shields.io/node/v/forwarded.svg
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/forwarded/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/forwarded?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/forwarded.svg
|
||||
[downloads-url]: https://npmjs.org/package/forwarded
|
||||
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 TJ Holowaychuk
|
||||
Copyright (c) 2014-2022 Douglas Christopher Wilson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user