Kind: Interface
Source: src/helper/conninfo/types.ts
Part of: Helper
HTTP Connection information
ConnInfo describes HTTP connection metadata associated with an incoming request. It currently exposes the remote endpoint address through the remote field, represented by NetAddrInfo.
Properties
| Property | Type |
|---|---|
remote | NetAddrInfo |
Diagram
mermaidgraph LR Request[Incoming HTTP Request] --> ConnInfo[ConnInfo] ConnInfo --> Remote[remote: NetAddrInfo]
Usage
tsimport type { ConnInfo } from "./helper/conninfo/types.ts";
function logRemoteAddress(connInfo: ConnInfo) {
console.log("Remote address:", connInfo.remote);
}
// `connInfo` is typically provided by the HTTP server runtime.
function handleRequest(request: Request, connInfo: ConnInfo) {
logRemoteAddress(connInfo);
return new Response("OK");
}
AI Coding Instructions
- Treat
ConnInfoas request-scoped metadata supplied by the HTTP server layer. - Read the client endpoint from
connInfo.remote; do not infer it from request headers. - Keep
ConnInfofields typed with connection-related types such asNetAddrInfo. - Pass
ConnInfothrough handlers when request logic needs remote connection details.
Was this page helpful?