interface · Browser and Node

# MeshOptions

`@toip-tools/mesh-transport` · [View source](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/mesh-transport/src/mesh.ts#L65)

Import:

```ts
import { type MeshOptions } from "@toip-tools/mesh-transport";
```

## Declaration

interface:

```ts
interface MeshOptions {
  /** Every local VID. attach() must name one of them. */
  identities: Identity[];
  links: Link[];
  scheduler?: Scheduler;
  contacts?: ContactStore;
  outbox?: MeshOutboxStore;
  /** Gateways this node may use. */
  gateways?: { vid: string }[];
  /** Repeat flooded packets for others. Default false (a phone); set true for fixed nodes. */
  relay?: boolean;
  /** `unknown`: how to reach a recipient never heard: flood it (default), try one hop, or wait in the outbox. */
  flood?: { maxTtl: number; relayShare: number; unknown?: "flood" | "direct" | "off" };
  arq?: { maxRounds: number; burst: number };
  /** How long post() waits for an answer before saying "queued". */
  postWaitMs?: (bytes: number) => number;
  acceptIntros?: boolean | ((sender: string) => boolean);
  onEvent?: (e: MeshEvent) => void;
  /** Randomness for jitter. Seed it in simulations. */
  random?: () => number;
}
```

## Properties

**`identities` (required)**

`Identity[]`

Every local VID. attach() must name one of them.

**`links` (required)**

`Link[]`

**`scheduler` (optional)**

`Scheduler | undefined`

**`contacts` (optional)**

`ContactStore | undefined`

**`outbox` (optional)**

`MeshOutboxStore | undefined`

**`gateways` (optional)**

`{ vid: string; }[] | undefined`

Gateways this node may use.

**`relay` (optional)**

`boolean | undefined`

Repeat flooded packets for others. Default false (a phone); set true for fixed nodes.

**`flood` (optional)**

`{ maxTtl: number; relayShare: number; unknown?: "flood" | "direct" | "off"; } | undefined`

`unknown`: how to reach a recipient never heard: flood it (default), try one hop, or wait in the outbox.

**`arq` (optional)**

`{ maxRounds: number; burst: number; } | undefined`

**`postWaitMs` (optional)**

`((bytes: number) => number) | undefined`

How long post() waits for an answer before saying "queued".

**`acceptIntros` (optional)**

`boolean | ((sender: string) => boolean) | undefined`

**`onEvent` (optional)**

`((e: MeshEvent) => void) | undefined`

**`random` (optional)**

`(() => number) | undefined`

Randomness for jitter. Seed it in simulations.

[Usage guide](https://toip.tools/toolkit/mesh-transport/#usage) · [Error handling](https://toip.tools/toolkit/mesh-transport/#errors) · [All exports](https://toip.tools/toolkit/mesh-transport/api/)

---

This is the Markdown version of https://toip.tools/toolkit/mesh-transport/api/MeshOptions/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
