Aktueller Stand
This commit is contained in:
24
backend/node_modules/@fastify/forwarded/LICENSE
generated
vendored
Normal file
24
backend/node_modules/@fastify/forwarded/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-2017 Douglas Christopher Wilson
|
||||
Copyright (c) 2021-present The Fastify team
|
||||
|
||||
The Fastify team members are listed at https://github.com/fastify/fastify#team.
|
||||
|
||||
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.
|
||||
43
backend/node_modules/@fastify/forwarded/README.md
generated
vendored
Normal file
43
backend/node_modules/@fastify/forwarded/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# @fastify/forwarded
|
||||
|
||||
[](https://github.com/fastify/forwarded/actions/workflows/ci.yml)
|
||||
[](https://www.npmjs.com/package/@fastify/forwarded)
|
||||
[](https://github.com/neostandard/neostandard)
|
||||
|
||||
Parse HTTP X-Forwarded-For header.
|
||||
|
||||
Updated version of the great https://github.com/jshttp/forwarded.
|
||||
Implements https://github.com/jshttp/forwarded/pull/9.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm i @fastify/forwarded
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
const forwarded = require('@fastify/forwarded')
|
||||
```
|
||||
|
||||
### forwarded(req)
|
||||
|
||||
```js
|
||||
const 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)
|
||||
59
backend/node_modules/@fastify/forwarded/index.js
generated
vendored
Normal file
59
backend/node_modules/@fastify/forwarded/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* forwarded
|
||||
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Get all addresses in the request used in the `X-Forwarded-For` header.
|
||||
*/
|
||||
function forwarded (req) {
|
||||
if (!req) {
|
||||
throw new TypeError('argument req is required')
|
||||
}
|
||||
|
||||
const header = req.headers['x-forwarded-for']
|
||||
const socketAddr = req.socket.remoteAddress
|
||||
|
||||
if (!header || typeof header !== 'string') {
|
||||
return [socketAddr]
|
||||
} else if (header.indexOf(',') === -1) {
|
||||
const remote = header.trim()
|
||||
return (remote.length)
|
||||
? [socketAddr, remote]
|
||||
: [socketAddr]
|
||||
} else {
|
||||
return parse(header, socketAddr)
|
||||
}
|
||||
}
|
||||
|
||||
function parse (header, socketAddr) {
|
||||
const result = [socketAddr]
|
||||
|
||||
let end = header.length
|
||||
let start = end
|
||||
let char
|
||||
let i
|
||||
|
||||
for (i = end - 1; i >= 0; --i) {
|
||||
char = header[i]
|
||||
if (char === ' ') {
|
||||
(start === end) && (start = end = i)
|
||||
} else if (char === ',') {
|
||||
(start !== end) && result.push(header.slice(start, end))
|
||||
start = end = i
|
||||
} else {
|
||||
start = i
|
||||
}
|
||||
}
|
||||
|
||||
(start !== end) && result.push(header.substring(start, end))
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = forwarded
|
||||
module.exports.default = forwarded
|
||||
module.exports.forwarded = forwarded
|
||||
74
backend/node_modules/@fastify/forwarded/package.json
generated
vendored
Normal file
74
backend/node_modules/@fastify/forwarded/package.json
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "@fastify/forwarded",
|
||||
"description": "Parse HTTP X-Forwarded-For header",
|
||||
"version": "3.0.1",
|
||||
"type": "commonjs",
|
||||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Matteo Collina",
|
||||
"email": "hello@matteocollina.com"
|
||||
},
|
||||
{
|
||||
"name": "James Sumners",
|
||||
"url": "https://james.sumners.info"
|
||||
},
|
||||
{
|
||||
"name": "Aras Abbasi",
|
||||
"email": "aras.abbasi@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Frazer Smith",
|
||||
"email": "frazer.dev@icloud.com",
|
||||
"url": "https://github.com/fdawgs"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"x-forwarded-for",
|
||||
"http",
|
||||
"req"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/fastify/forwarded.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/fastify/forwarded/issues"
|
||||
},
|
||||
"homepage": "https://github.com/fastify/forwarded#readme",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fastify"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/fastify"
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.0.8",
|
||||
"benchmark": "2.1.4",
|
||||
"c8": "^10.1.2",
|
||||
"eslint": "^9.17.0",
|
||||
"neostandard": "^0.12.0",
|
||||
"tsd": "^0.33.0"
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"bench": "node benchmark/index.js",
|
||||
"bench:combined": "node benchmark/combined.js",
|
||||
"lint": "eslint",
|
||||
"lint:fix": "eslint --fix",
|
||||
"test": "npm run test:unit && npm run test:typescript",
|
||||
"test:unit": "c8 --100 node --test",
|
||||
"test:typescript": "tsd"
|
||||
}
|
||||
}
|
||||
14
backend/node_modules/@fastify/forwarded/types/index.d.ts
generated
vendored
Normal file
14
backend/node_modules/@fastify/forwarded/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { IncomingMessage } from 'node:http'
|
||||
|
||||
type Forwarded = (req: IncomingMessage) => string[]
|
||||
|
||||
declare namespace forwarded {
|
||||
export const forwarded: Forwarded
|
||||
export { forwarded as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all addresses in the request used in the `X-Forwarded-For` header.
|
||||
*/
|
||||
declare function forwarded (...params: Parameters<Forwarded>): ReturnType<Forwarded>
|
||||
export = forwarded
|
||||
Reference in New Issue
Block a user