{"name":"blind-relay","version":"1.5.0","author":{"name":"Holepunch"},"license":"Apache-2.0","_id":"blind-relay@1.5.0","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"homepage":"https://github.com/holepunchto/blind-relay#readme","bugs":{"url":"https://github.com/holepunchto/blind-relay/issues"},"dist":{"shasum":"d69b61f91915e8bcde13228f5a9311a32b88b825","tarball":"http://registry-npm.ywwl.com/blind-relay/download/blind-relay-1.5.0.tgz","fileCount":5,"integrity":"sha512-WwTaNv0Ea+L8PJq6KfQiwjuelyyDVDCV3Y8ym5cjoEBXjKK51oSy9Q3SHqSb1y2ddfz3yZZDvSg5xfN7ObayVw==","signatures":[{"sig":"MEYCIQDGOtpezzKOmS4zpRG9dxl+GmGwYxjhEgXlnbgLhDBzzAIhAOws7/PDDGUJgnYH/D8DhfiKVVT0MBpHlm06fZeJXwSt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/blind-relay@1.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":28931,"size":8351,"noattachment":false,"key":"/blind-relay/-/blind-relay-1.5.0.tgz"},"main":"index.js","gitHead":"2f7c7dc455c39fd575d004900427d94ae03e211e","imports":{"events":{"bare":"bare-events","default":"events"}},"scripts":{"lint":"prettier --check . && lunte","test":"npm run test:bare","format":"prettier --write .","test:bare":"brittle-bare --coverage test.mjs"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:89d127b1-5c7e-4fa7-ab13-31fb4a8796d7"}},"repository":{"url":"git+https://github.com/holepunchto/blind-relay.git","type":"git"},"_npmVersion":"11.11.0","description":"Blind relay for UDX over Protomux channels","directories":{},"_nodeVersion":"24.14.1","dependencies":{"b4a":"^1.6.4","streamx":"^2.15.1","protomux":"^3.5.1","bare-events":"^2.2.0","bits-to-bytes":"^1.3.0","compact-encoding":"^2.12.0","sodium-universal":"^5.0.0","compact-encoding-bitfield":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"lunte":"^1.0.0","brittle":"^3.2.1","hyperdht":"^6.6.1","prettier":"^3.6.2","udx-native":"^1.6.1","prettier-config-holepunch":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/blind-relay_1.5.0_1777319614753_0.3133048557153013","host":"s3://npm-registry-packages-npm-production"},"readme":"# blind-relay\n\nBlind 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).\n\n```sh\nnpm i blind-relay\n```\n\n## Protocol\n\n```mermaid\nsequenceDiagram\n    actor a as peer a\n    actor r as relay\n    actor b as peer b\n\n    par\n        a ->> r: pair { isInitiator: true, token, id, seq }\n    and\n        b ->> r: pair { isInitiator: false, token, id, seq }\n    end\n\n    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\n\n    par\n        r -->> a: pair { isInitiator: true, token, id, seq }\n    and\n        r -->> b: pair { isInitiator: false, token, id, seq }\n    end\n\n    par\n        a ->> r: unpair { token }\n\n        note left of r: The relay deallocates the stream previously allocated to peer a\n    and\n        b ->> r: unpair { token }\n\n        note right of r: The relay deallocates the stream previously allocated to peer b\n    end\n```\n\n### Messages\n\nAll types are specified as their corresponding [compact-encoding](https://github.com/compact-encoding) codec.\n\n#### `pair` (`0`)\n\n1.  `bitfield(1)` Flags.\n    1. `isInitiator`\n2.  `fixed32` Preexchanged token.\n3.  `uint` Stream ID of the sender.\n4.  `uint` Initial stream sequence no. of the sender.\n\n#### `unpair` (`1`)\n\n1.  `bitfield(0)` Flags, reserved.\n2.  `fixed32` Preexchanged token.\n\n## Stats\n\nRelay servers expose in-memory stats on `server.stats`.\n\n- `sessions.accepted`, `sessions.opened`, `sessions.closed`, `sessions.active`\n- `pairings.requested`, `pairings.matched`, `pairings.cancelled`, `pairings.pending`, `pairings.active`\n- `streams.opened`, `streams.closed`, `streams.errors`, `streams.active`\n\nAll counters are cumulative for the lifetime of the process, while `active` and `pending` values reflect the current relay state.\n\n## License\n\nApache-2.0\n","publish_time":1777319614893,"_cnpm_publish_time":1777319614893,"dist-tags":{"latest":"1.6.1"}}