# blind-relay

> Blind relay for UDX over Protomux channels

Latest version **1.6.1** (published 2026-05-06) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install blind-relay
pnpm add blind-relay
yarn add blind-relay
bun add blind-relay
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.6.1 |
| Published | 2026-05-06 |
| First published | 2023-09-29 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 28.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 9 |
| Author | Holepunch |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/blind-relay
- Repository: https://github.com/holepunchto/blind-relay
- Homepage: https://github.com/holepunchto/blind-relay#readme
- Issues: https://github.com/holepunchto/blind-relay/issues
- npm.io page: https://npm.io/package/blind-relay

## Dependencies (8)

- [b4a](https://npm.io/package/b4a.md) ^1.6.4
- [streamx](https://npm.io/package/streamx.md) ^2.15.1
- [protomux](https://npm.io/package/protomux.md) ^3.5.1
- [bare-events](https://npm.io/package/bare-events.md) ^2.2.0
- [bits-to-bytes](https://npm.io/package/bits-to-bytes.md) ^1.3.0
- [compact-encoding](https://npm.io/package/compact-encoding.md) ^3.0.0
- [sodium-universal](https://npm.io/package/sodium-universal.md) ^5.0.0
- [compact-encoding-bitfield](https://npm.io/package/compact-encoding-bitfield.md) ^1.0.0

## Recent versions

- 1.6.1 (latest) — 2026-05-06
- 1.6.0 — 2026-05-05
- 1.5.0 — 2026-04-27
- 1.4.0 — 2025-04-12
- 1.3.3 — 2024-03-13
- 1.3.2 — 2024-02-08
- 1.3.1 — 2023-10-05
- 1.3.0 — 2023-09-29

## README

# blind-relay

Blind relay for [UDX](https://github.com/holepunchto/udx-native) over [Protomux](https://github.com/mafintosh/protomux) channels. By acting as a blind relay, a host may accept pairing requests from other hosts and relay UDX stream messages between them, similar to Traversal Using Relays around NAT (TURN).

```sh
npm i blind-relay
```

## Protocol

```mermaid
sequenceDiagram
    actor a as peer a
    actor r as relay
    actor b as peer b

    par
        a ->> r: pair { isInitiator: true, token, id, seq }
    and
        b ->> r: pair { isInitiator: false, token, id, seq }
    end

    note over r: The relay pairs peers a and b based on the token, allocates a new stream for both peers, and sends back the stream info

    par
        r -->> a: pair { isInitiator: true, token, id, seq }
    and
        r -->> b: pair { isInitiator: false, token, id, seq }
    end

    par
        a ->> r: unpair { token }

        note left of r: The relay deallocates the stream previously allocated to peer a
    and
        b ->> r: unpair { token }

        note right of r: The relay deallocates the stream previously allocated to peer b
    end
```

### Messages

All types are specified as their corresponding [compact-encoding](https://github.com/compact-encoding) codec.

#### `pair` (`0`)

1.  `bitfield(1)` Flags.
    1. `isInitiator`
2.  `fixed32` Preexchanged token.
3.  `uint` Stream ID of the sender.
4.  `uint` Initial stream sequence no. of the sender.

#### `unpair` (`1`)

1.  `bitfield(0)` Flags, reserved.
2.  `fixed32` Preexchanged token.

## Stats

Relay servers expose in-memory stats on `server.stats`.

- `sessions.accepted`, `sessions.opened`, `sessions.closed`, `sessions.active`
- `pairings.requested`, `pairings.matched`, `pairings.cancelled`, `pairings.pending`, `pairings.active`
- `streams.opened`, `streams.closed`, `streams.errors`, `streams.active`

All counters are cumulative for the lifetime of the process, while `active` and `pending` values reflect the current relay state.

## License

Apache-2.0

---
_Source: https://npm.io/package/blind-relay · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
