Files
SnowLuma/.pnpm-store/v11/files/6c/60b0e9e6efb1693ec862aa5f41619e65f40d504849df4d1eba622510bb92705ac0b46adae4bf448b80068094906a1cde45313f13d207d9f1ddd8aca5e10463
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

26 lines
841 B
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region src/adapter/cloudflare-pages/conninfo.ts
/**
* Get connection information from Cloudflare Pages
* @param c - Context
* @returns Connection information including remote address
* @example
* ```ts
* import { Hono } from 'hono'
* import { handle, getConnInfo } from 'hono/cloudflare-pages'
*
* const app = new Hono()
*
* app.get('/', (c) => {
* const info = getConnInfo(c)
* return c.text(`Your IP: ${info.remote.address}`)
* })
*
* export const onRequest = handle(app)
* ```
* @deprecated `hono/cloudflare-pages` will be removed in v5. Cloudflare recommends Workers with static assets; use `hono` on Workers instead.
*/
const getConnInfo = (c) => ({ remote: { address: c.req.header("cf-connecting-ip") } });
//#endregion
exports.getConnInfo = getConnInfo;