{"name":"blind-relay","version":"1.6.1","description":"Blind relay for UDX over Protomux channels","main":"index.js","scripts":{"format":"prettier --write .","lint":"prettier --check . && lunte","test":"npm run test:bare","test:bare":"brittle-bare --coverage test.mjs"},"repository":{"type":"git","url":"git+https://github.com/holepunchto/blind-relay.git"},"author":{"name":"Holepunch"},"license":"Apache-2.0","bugs":{"url":"https://github.com/holepunchto/blind-relay/issues"},"homepage":"https://github.com/holepunchto/blind-relay#readme","imports":{"events":{"bare":"bare-events","default":"events"}},"dependencies":{"b4a":"^1.6.4","bare-events":"^2.2.0","bits-to-bytes":"^1.3.0","compact-encoding":"^3.0.0","compact-encoding-bitfield":"^1.0.0","protomux":"^3.5.1","sodium-universal":"^5.0.0","streamx":"^2.15.1"},"devDependencies":{"brittle":"^3.2.1","hyperdht":"^6.6.1","lunte":"^1.0.0","prettier":"^3.6.2","prettier-config-holepunch":"^2.0.0","udx-native":"^1.6.1"},"gitHead":"296032773e6c253a688dec9dd1d31674fdef2f3d","_id":"blind-relay@1.6.1","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-38YmKCl/m9NcTkwueBbcGIt9Zx3IT/Q9Nsluu6C5Gur6PqfE0zWPhPwCzia1hri/g0ICYxrqkgLtEaoWD5WeSQ==","shasum":"a182b807de26b8d924abe39e977e11cdbccd69f0","tarball":"http://registry-npm.ywwl.com/blind-relay/download/blind-relay-1.6.1.tgz","fileCount":5,"unpackedSize":29085,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/blind-relay@1.6.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCZg2vyDXzw0/Baze/15W6EuIncctJzuVTl25EDnEJoIAIhAP5RV54rhb00ajbf8KBU1H3BWXtd3fYpgkB6qO7hw3/1"}],"size":8380,"noattachment":false,"key":"/blind-relay/-/blind-relay-1.6.1.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:89d127b1-5c7e-4fa7-ab13-31fb4a8796d7"}},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/blind-relay_1.6.1_1778100691687_0.3425663515924646"},"_hasShrinkwrap":false,"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":1778100691848,"_cnpm_publish_time":1778100691848,"dist-tags":{"latest":"1.6.1"}}