# @suaveplan/bitpacker-network - Bitpacker network plugin ## Summary Network simulation utilities for testing bitpacker under realistic network conditions. ## Documentation tree - [defaults](./src/defaults/defaults.md) — _(no submodules)_ - [default-clock](./src/defaults/default-clock.md) — `defaultClock` is the **single allow-listed wall-clock source** in `@suaveplan/bitpacker-network`. The determin… - [default-rng](./src/defaults/default-rng.md) — `defaultRng` is the canonical CSPRNG-backed `Rng` factory used by `NetworkSimulator` and any other deterministic-when-a… - [defaults](./src/defaults/defaults.md) — _(no submodules)_ - [otel](./src/otel/instruments.md) — _(no submodules)_ - [instruments](./src/otel/instruments.md) — _(no submodules)_ - [register-schemas](./src/register-schemas/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the `@suaveplan/bitpacker-network` package. Exposes `regis… - [register-schemas](./src/register-schemas/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the `@suaveplan/bitpacker-network` package. Exposes `regis… - [simulator](./src/simulator/simulator.md) — _(no submodules)_ - simulator.schema — Zod schema for `NetworkSimulator… - [simulator](./src/simulator/simulator.md) — _(no submodules)_ - simulator.schema — Zod schema for `NetworkSimulator… - [simulator.schema](./src/simulator/simulator.schema.md) — Zod schema for `NetworkSimulatorConstructorOptions`, the constructor bundle for `NetworkSimulator` and `createNetworkSi… - [types](./src/types/types.md) — _(no submodules)_ - types.schema — Zod schema for `NetworkSimulationOpt… - [types](./src/types/types.md) — _(no submodules)_ - types.schema — Zod schema for `NetworkSimulationOpt… - [types.schema](./src/types/types.schema.md) — Zod schema for `NetworkSimulationOptions`, the configuration accepted by `NetworkSimulator`'s constructor and `setOptio… - [index](./src/index.md) — **Path:** `bitpacker-network/src/index.ts` **Export:** See source for details. - [default-clock](./src/defaults/default-clock.md) — `defaultClock` is the **single allow-listed wall-clock source** in `@suaveplan/bitpacker-network`. The determin… - [default-rng](./src/defaults/default-rng.md) — `defaultRng` is the canonical CSPRNG-backed `Rng` factory used by `NetworkSimulator` and any other deterministic-when-a… - [defaults](./src/defaults/defaults.md) — _(no submodules)_- [otel](./src/otel/instruments.md) — _(no submodules)_- [instruments](./src/otel/instruments.md) — _(no submodules)_- [simulator](./src/simulator/simulator.md) — _(no submodules)_- simulator.schema — Zod schema for `NetworkSimulator… - [simulator](./src/simulator/simulator.md) — _(no submodules)_- simulator.schema — Zod schema for `NetworkSimulator… - [simulator.schema](./src/simulator/simulator.schema.md) — Zod schema for `NetworkSimulatorConstructorOptions`, the constructor bundle for `NetworkSimulator` and `createNetworkSi… - [types](./src/types/types.md) — _(no submodules)_- types.schema — Zod schema for `NetworkSimulationOpt… - [types](./src/types/types.md) — _(no submodules)_- types.schema — Zod schema for `NetworkSimulationOpt… - [types.schema](./src/types/types.schema.md) — Zod schema for `NetworkSimulationOptions`, the configuration accepted by `NetworkSimulator`'s constructor and `setOptio… - [index](./src/index.md) — **Path:** `bitpacker-network/src/index.ts` **Export:** See source for details. - [register-schemas](./src/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the `@suaveplan/bitpacker-network` package. Exposes `regis… - [default-clock](./src/defaults/default-clock.md) — `defaultClock` is the **single allow-listed wall-clock source** in `@suaveplan/bitpacker-network`. The determin… - [default-rng](./src/defaults/default-rng.md) — `defaultRng` is the canonical CSPRNG-backed `Rng` factory used by `NetworkSimulator` and any other deterministic-when-a… - [defaults](./src/defaults/defaults.md) — _(no submodules)_- [otel](./src/otel/instruments.md) — _(no submodules)_- [instruments](./src/otel/instruments.md) — _(no submodules)_- [simulator](./src/simulator/simulator.md) — _(no submodules)_- simulator.schema — Zod schema for `NetworkSimulator… - [simulator](./src/simulator/simulator.md) — _(no submodules)_- simulator.schema — Zod schema for `NetworkSimulator… - [simulator.schema](./src/simulator/simulator.schema.md) — Zod schema for `NetworkSimulatorConstructorOptions`, the constructor bundle for `NetworkSimulator` and `createNetworkSi… - [types](./src/types/types.md) — _(no submodules)_- types.schema — Zod schema for `NetworkSimulationOpt… - [types](./src/types/types.md) — _(no submodules)_- types.schema — Zod schema for `NetworkSimulationOpt… - [types.schema](./src/types/types.schema.md) — Zod schema for `NetworkSimulationOptions`, the configuration accepted by `NetworkSimulator`'s constructor and `setOptio… - [index](./src/index.md) — **Path:** `bitpacker-network/src/index.ts` **Export:** See source for details. - [register-schemas](./src/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the `@suaveplan/bitpacker-network` package. Exposes `regis… - [default-clock](./src/defaults/default-clock.md) — `defaultClock` is the **single allow-listed wall-clock source** in `@suaveplan/bitpacker-network`. The determin… - [default-rng](./src/defaults/default-rng.md) — `defaultRng` is the canonical CSPRNG-backed `Rng` factory used by `NetworkSimulator` and any other deterministic-when-a… - [defaults](./src/defaults/defaults.md) — _(no submodules)_- [otel](./src/otel/instruments.md) — _(no submodules)_- [instruments](./src/otel/instruments.md) — _(no submodules)_- [simulator](./src/simulator/simulator.md) — _(no submodules)_- simulator.schema — Zod schema for `NetworkSimulator… - [simulator](./src/simulator/simulator.md) — _(no submodules)_- simulator.schema — Zod schema for `NetworkSimulator… - [simulator.schema](./src/simulator/simulator.schema.md) — Zod schema for `NetworkSimulatorConstructorOptions`, the constructor bundle for `NetworkSimulator` and `createNetworkSi… - [types](./src/types/types.md) — _(no submodules)_- types.schema — Zod schema for `NetworkSimulationOpt… - [types](./src/types/types.md) — _(no submodules)_- types.schema — Zod schema for `NetworkSimulationOpt… - [types.schema](./src/types/types.schema.md) — Zod schema for `NetworkSimulationOptions`, the configuration accepted by `NetworkSimulator`'s constructor and `setOptio… - [index](./src/index.md) — **Path:** `bitpacker-network/src/index.ts` **Export:** See source for details. - [register-schemas](./src/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the `@suaveplan/bitpacker-network` package. Exposes `regis… - [default-clock](./src/defaults/default-clock.md) — `defaultClock` is the **single allow-listed wall-clock source** in `@suaveplan/bitpacker-network`. The determin… - [default-rng](./src/defaults/default-rng.md) — `defaultRng` is the canonical CSPRNG-backed `Rng` factory used by `NetworkSimulator` and any other deterministic-when-a… - [defaults](./src/defaults/defaults.md) — _(no submodules)_- [otel](./src/otel/instruments.md) — _(no submodules)_ - [instruments](./src/otel/instruments.md) — _(no submodules)_- [simulator](./src/simulator/simulator.md) — _(no submodules)_ - [simulator](./src/simulator/simulator.md) — _(no submodules)_ - [simulator.schema](./src/simulator/simulator.schema.md) — Zod schema for `NetworkSimulatorConstructorOptions`, the constructor bundle for `NetworkSimulator` and `createNetworkSi… - [types](./src/types/types.md) — _(no submodules)_ - [types](./src/types/types.md) — _(no submodules)_ - [types.schema](./src/types/types.schema.md) — Zod schema for `NetworkSimulationOptions`, the configuration accepted by `NetworkSimulator`'s constructor and `setOptio… - [index](./src/index.md) — **Path:** `bitpacker-network/src/index.ts` **Export:** See source for details. - [register-schemas](./src/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the `@suaveplan/bitpacker-network` package. Exposes `regis… ## Install ```bash bun add @suaveplan/bitpacker-network ``` ## Usage ```typescript import { NetworkSimulator } from "@suaveplan/bitpacker-network"; const sim = new NetworkSimulator({ latency: 50, jitter: 10, packetLoss: 0.02 }); sim.send(new Uint8Array([1, 2, 3])); const received = sim.receive(); // may drop packet based on loss rate ``` ## Modules - `src/index.ts` — `NetworkSimulator`: configurable latency, jitter, and packet loss simulation