Download node_modules/hono/dist/adapter/aws-lambda/conninfo.js from Snapkitty/agentscope-sift: direct link, hf CLI and curl.
- Browser
- Download file 634 Bytes
-
https://huggingface.co/Snapkitty/agentscope-sift/resolve/main/node_modules/hono/dist/adapter/aws-lambda/conninfo.js
- Command line
-
hf download hf://Snapkitty/agentscope-sift/node_modules/hono/dist/adapter/aws-lambda/conninfo.js
-
curl -L -o conninfo.js https://huggingface.co/Snapkitty/agentscope-sift/resolve/main/node_modules/hono/dist/adapter/aws-lambda/conninfo.js
634 Bytes
| // src/adapter/aws-lambda/conninfo.ts | |
| var getConnInfo = (c) => { | |
| const requestContext = c.env.requestContext; | |
| let address; | |
| if ("identity" in requestContext && requestContext.identity?.sourceIp) { | |
| address = requestContext.identity.sourceIp; | |
| } else if ("http" in requestContext && requestContext.http?.sourceIp) { | |
| address = requestContext.http.sourceIp; | |
| } else { | |
| const xff = c.req.header("x-forwarded-for"); | |
| if (xff) { | |
| const ips = xff.split(","); | |
| address = ips[ips.length - 1].trim(); | |
| } | |
| } | |
| return { | |
| remote: { | |
| address | |
| } | |
| }; | |
| }; | |
| export { | |
| getConnInfo | |
| }; | |