added doga
This commit is contained in:
21
25_02_24/node_modules/@tinyhttp/forwarded/LICENSE
generated
vendored
Normal file
21
25_02_24/node_modules/@tinyhttp/forwarded/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 v 1 r t l
|
||||
|
||||
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.
|
||||
17
25_02_24/node_modules/@tinyhttp/forwarded/README.md
generated
vendored
Normal file
17
25_02_24/node_modules/@tinyhttp/forwarded/README.md
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# @tinyhttp/forwarded
|
||||
|
||||
> [`forwarded`](https://github.com/jshttp/forwarded) rewrite in TypeScript
|
||||
|
||||
Determine address of a proxied request
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
pnpm i @tinyhttp/forwarded
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```ts
|
||||
import { forwarded } from '@tinyhttp/forwarded'
|
||||
```
|
||||
11
25_02_24/node_modules/@tinyhttp/forwarded/dist/index.d.ts
generated
vendored
Normal file
11
25_02_24/node_modules/@tinyhttp/forwarded/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/// <reference types="node" />
|
||||
import { IncomingMessage } from 'node:http';
|
||||
/**
|
||||
* Get all addresses in the request, using the `X-Forwarded-For` header.
|
||||
*/
|
||||
export declare function forwarded(req: Pick<IncomingMessage, 'headers' | 'socket'>): string[];
|
||||
/**
|
||||
* Parse the X-Forwarded-For header.
|
||||
*/
|
||||
export declare function parse(header: string): string[];
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
25_02_24/node_modules/@tinyhttp/forwarded/dist/index.d.ts.map
generated
vendored
Normal file
1
25_02_24/node_modules/@tinyhttp/forwarded/dist/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,QAAQ,CAAC,GAAG,MAAM,EAAE,CAOpF;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CA6B9C"}
|
||||
36
25_02_24/node_modules/@tinyhttp/forwarded/dist/index.js
generated
vendored
Normal file
36
25_02_24/node_modules/@tinyhttp/forwarded/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
function forwarded(req) {
|
||||
const proxyAddrs = parse(req.headers["x-forwarded-for"] || "");
|
||||
const socketAddr = req.socket.remoteAddress;
|
||||
return [socketAddr].concat(proxyAddrs);
|
||||
}
|
||||
function parse(header) {
|
||||
let end = header.length;
|
||||
const list = [];
|
||||
let start = header.length;
|
||||
for (let i = header.length - 1; i >= 0; i--) {
|
||||
switch (header.charCodeAt(i)) {
|
||||
case 32:
|
||||
if (start === end) {
|
||||
start = end = i;
|
||||
}
|
||||
break;
|
||||
case 44:
|
||||
if (start !== end) {
|
||||
list.push(header.substring(start, end));
|
||||
}
|
||||
start = end = i;
|
||||
break;
|
||||
default:
|
||||
start = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (start !== end)
|
||||
list.push(header.substring(start, end));
|
||||
return list;
|
||||
}
|
||||
export {
|
||||
forwarded,
|
||||
parse
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
25_02_24/node_modules/@tinyhttp/forwarded/dist/index.js.map
generated
vendored
Normal file
1
25_02_24/node_modules/@tinyhttp/forwarded/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { IncomingMessage } from 'node:http'\n\n/**\n * Get all addresses in the request, using the `X-Forwarded-For` header.\n */\nexport function forwarded(req: Pick<IncomingMessage, 'headers' | 'socket'>): string[] {\n // simple header parsing\n const proxyAddrs = parse((req.headers['x-forwarded-for'] as string) || '')\n const socketAddr = req.socket.remoteAddress\n\n // return all addresses\n return [socketAddr].concat(proxyAddrs)\n}\n\n/**\n * Parse the X-Forwarded-For header.\n */\nexport function parse(header: string): string[] {\n let end = header.length\n const list: string[] = []\n let start = header.length\n\n // gather addresses, backwards\n for (let i = header.length - 1; i >= 0; i--) {\n switch (header.charCodeAt(i)) {\n case 0x20 /* */:\n if (start === end) {\n start = end = i\n }\n break\n case 0x2c /* , */:\n if (start !== end) {\n list.push(header.substring(start, end))\n }\n start = end = i\n break\n default:\n start = i\n break\n }\n }\n\n // final address\n if (start !== end) list.push(header.substring(start, end))\n\n return list\n}\n"],"names":[],"mappings":"AAKO,SAAS,UAAU,KAA4D;AAEpF,QAAM,aAAa,MAAO,IAAI,QAAQ,iBAAiB,KAAgB,EAAE;AACnE,QAAA,aAAa,IAAI,OAAO;AAG9B,SAAO,CAAC,UAAU,EAAE,OAAO,UAAU;AACvC;AAKO,SAAS,MAAM,QAA0B;AAC9C,MAAI,MAAM,OAAO;AACjB,QAAM,OAAiB,CAAA;AACvB,MAAI,QAAQ,OAAO;AAGnB,WAAS,IAAI,OAAO,SAAS,GAAG,KAAK,GAAG,KAAK;AACnC,YAAA,OAAO,WAAW,CAAC,GAAG;AAAA,MAC5B,KAAK;AACH,YAAI,UAAU,KAAK;AACjB,kBAAQ,MAAM;AAAA,QAChB;AACA;AAAA,MACF,KAAK;AACH,YAAI,UAAU,KAAK;AACjB,eAAK,KAAK,OAAO,UAAU,OAAO,GAAG,CAAC;AAAA,QACxC;AACA,gBAAQ,MAAM;AACd;AAAA,MACF;AACU,gBAAA;AACR;AAAA,IACJ;AAAA,EACF;AAGA,MAAI,UAAU;AAAK,SAAK,KAAK,OAAO,UAAU,OAAO,GAAG,CAAC;AAElD,SAAA;AACT;"}
|
||||
36
25_02_24/node_modules/@tinyhttp/forwarded/package.json
generated
vendored
Normal file
36
25_02_24/node_modules/@tinyhttp/forwarded/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@tinyhttp/forwarded",
|
||||
"version": "2.1.2",
|
||||
"type": "module",
|
||||
"description": "forwarded rewrite with TypeScript and ESM support",
|
||||
"homepage": "https://tinyhttp.v1rtl.site",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tinyhttp/tinyhttp.git",
|
||||
"directory": "packages/forwarded"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": "./dist/index.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"keywords": [
|
||||
"tinyhttp",
|
||||
"node.js",
|
||||
"web framework",
|
||||
"web",
|
||||
"backend",
|
||||
"forwarded",
|
||||
"headers",
|
||||
"header"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
},
|
||||
"author": "v1rtl",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user