# expandIPv6

**Kind:** Function

**Source:** [`src/utils/ipaddr.ts`](https://github.com/honojs/hono/blob/main/src/utils/ipaddr.ts#L13)

**Part of:** [Utils](subsystem-src-utils)

Expand IPv6 Address

`expandIPv6` expands an IPv6 address that uses compressed notation into its expanded colon-separated form. It is used by IP address handling code when later operations need each address segment represented explicitly.

## Signature

```ts
function expandIPv6(ipV6: string): string
```

## Parameters

| Name | Type |
|---|---|
| `ipV6` | `string` |

**Returns:** `string`

## Diagram

```mermaid
graph LR
  A[Compressed IPv6 address] --> B[expandIPv6]
  B --> C[Split address segments]
  C --> D[Expand omitted segments]
  D --> E[Expanded IPv6 address]
```

## Usage

```ts
import { expandIPv6 } from './utils/ipaddr';

const address = 'a::b';
const expandedAddress = expandIPv6(address);

console.log(expandedAddress);
```

## AI Coding Instructions

- Pass IPv6 address strings to `expandIPv6` before code that requires explicit address segments.
- Keep compressed-address handling inside this utility rather than duplicating expansion logic in callers.
- Preserve colon-separated IPv6 formatting when changing this function.
- Check how callers handle invalid or already-expanded addresses before changing return behavior.
