Skip to content

ConnInfo

reference
1 min readUpdated

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

PropertyType
remoteNetAddrInfo

Diagram

mermaid
graph LR
  Request[Incoming HTTP Request] --> ConnInfo[ConnInfo]
  ConnInfo --> Remote[remote: NetAddrInfo]

Usage

ts
import 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 ConnInfo as request-scoped metadata supplied by the HTTP server layer.
  • Read the client endpoint from connInfo.remote; do not infer it from request headers.
  • Keep ConnInfo fields typed with connection-related types such as NetAddrInfo.
  • Pass ConnInfo through handlers when request logic needs remote connection details.

Was this page helpful?

Download as PDF
ConnInfo — Hono (narrator proof)