Files
SnowLuma/.pnpm-store/v11/files/fe/8e4a0edbfd505d2b195ec19d6955ca93ae877627a7ec04dda8cb72a3faa238699618feb0a81785943f40b417f6143bfc2f66faf0bafbe1dfca79781e96e086
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

24 lines
903 B
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_adapter_bun_server = require("./server.js");
//#region src/adapter/bun/conninfo.ts
/**
* Get ConnInfo with Bun
* @param c Context
* @returns ConnInfo
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
const getConnInfo = (c) => {
const server = require_adapter_bun_server.getBunServer(c);
if (!server) throw new TypeError("env has to include the 2nd argument of fetch.");
if (typeof server.requestIP !== "function") throw new TypeError("server.requestIP is not a function.");
const info = server.requestIP(c.req.raw);
if (!info) return { remote: {} };
return { remote: {
address: info.address,
addressType: info.family === "IPv6" || info.family === "IPv4" ? info.family : void 0,
port: info.port
} };
};
//#endregion
exports.getConnInfo = getConnInfo;