(c: Context)
| 119 | |
| 120 | /** Extracts the Node socket-level remote address from the Hono context. */ |
| 121 | export function getSocketRemoteAddress(c: Context): string | undefined { |
| 122 | // @hono/node-server exposes the raw Node IncomingMessage as c.env.incoming |
| 123 | const env = c.env as { incoming?: { socket?: { remoteAddress?: string } } } | undefined |
| 124 | return env?.incoming?.socket?.remoteAddress |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Normalize an IP literal for comparison: strip the IPv6 zone suffix |
no outgoing calls
no test coverage detected