---
title: Tunnel
description: A running tunnel. Call stop() when done; a garbage-collected handle stops the tunnel and cuts its open connections.
---

A running tunnel. Call `stop()` when done; a garbage-collected handle stops the tunnel and
cuts its open connections.

## Accessors

### localAddress

#### Get Signature

```ts
get localAddress(): string;
```

The local address to connect to, `host:port`, with the port the OS picked.

##### Returns

`string`

***

### running

#### Get Signature

```ts
get running(): boolean;
```

Whether the tunnel is still serving.

##### Returns

`boolean`

## Methods

### stop()

```ts
stop(timeout?: number | null): Promise<TunnelReport>;
```

Stops accepting, waits for the connections still open to end, and resolves with the
report.

With `timeout` (seconds), connections still open after it are cut and listed as
`"failed"`. Without it, a client that keeps its connection open keeps this waiting.
Callable again, with the same report.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `timeout?` | `number` | `null` |

#### Returns

`Promise`\<[`TunnelReport`](/microvms-agentd/reference/typescript/interfaces/tunnelreport/)>

***

### toString()

```ts
toString(): string;
```

The handle without its credentials.

#### Returns

`string`

## Provenance

This page is generated from `bindings/microvms-js/index.d.ts` by TypeDoc 0.28.20 and typedoc-plugin-markdown 4.13.1, run from `site/scripts/gen-reference.mjs` on every `pnpm run sync`, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding's Rust source, then regenerate the declarations with `mise run dts`. `mise run dts:check` fails when the committed file no longer matches the source.