Skip to Content
docshelpersConninfo

Last Updated: 3/9/2026


ConnInfo Helper

The ConnInfo Helper helps you to get the connection information. For example, you can get the client’s remote address easily.

Import

::: code-group

import { Hono } from 'hono' import { getConnInfo } from 'hono/cloudflare-workers'
import { Hono } from 'hono' import { getConnInfo } from 'hono/deno'
import { Hono } from 'hono' import { getConnInfo } from 'hono/bun'
import { Hono } from 'hono' import { getConnInfo } from 'hono/vercel'
import { Hono } from 'hono' import { getConnInfo } from 'hono/aws-lambda'
import { Hono } from 'hono' import { getConnInfo } from 'hono/cloudflare-pages'
import { Hono } from 'hono' import { getConnInfo } from 'hono/netlify'
import { Hono } from 'hono' import { getConnInfo } from 'hono/lambda-edge'
import { Hono } from 'hono' import { getConnInfo } from '@hono/node-server/conninfo'

:::

Usage

const app = new Hono() app.get('/', (c) => { const info = getConnInfo(c) // info is `ConnInfo` return c.text(`Your remote address is ${info.remote.address}`) })

Type Definitions

The type definitions of the values that you can get from getConnInfo() are the following:

type AddressType = 'IPv6' | 'IPv4' | undefined type NetAddrInfo = { /** * Transport protocol type */ transport?: 'tcp' | 'udp' /** * Transport port number */ port?: number address?: string addressType?: AddressType } & ( | { /** * Host name such as IP Addr */ address: string /** * Host name type */ addressType: AddressType } | {} ) /** * HTTP Connection information */ interface ConnInfo { /** * Remote information */ remote: NetAddrInfo }