{"name":"blind-relay","version":"1.4.0","author":{"name":"Holepunch"},"license":"Apache-2.0","_id":"blind-relay@1.4.0","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"kasperisager","email":"kasperisager@hey.com"}],"homepage":"https://github.com/holepunchto/blind-relay#readme","bugs":{"url":"https://github.com/holepunchto/blind-relay/issues"},"dist":{"shasum":"1c01263e9f9297c2f898668fcc1693fd816a8beb","tarball":"http://registry-npm.ywwl.com/blind-relay/download/blind-relay-1.4.0.tgz","fileCount":5,"integrity":"sha512-6xt7fDfCs6eGmNNym6I9N42jmjcMQn2qwwOVnkP9ZnrkXFk6c4/tdO1xqRmDEzKzV8gigd+DVdCUG/RUYnen7Q==","signatures":[{"sig":"MEQCIBhZSyttq+aba06J8umEB7ossuWqyaR8/Ry2geBsZ3bUAiADzSVdYRDtxk0unz8/zqS8qinxI6RJFdqZFyBmJnJa4g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25892,"size":7654,"noattachment":false,"key":"/blind-relay/-/blind-relay-1.4.0.tgz"},"main":"index.js","gitHead":"14f3673be76469e69908f1517aa6648a1dcccb79","imports":{"events":{"bare":"bare-events","default":"events"}},"scripts":{"test":"standard && brittle test.mjs"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"repository":{"url":"git+https://github.com/holepunchto/blind-relay.git","type":"git"},"_npmVersion":"10.9.0","description":"Blind relay for UDX over Protomux channels","directories":{},"_nodeVersion":"22.12.0","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":{"brittle":"^3.2.1","hyperdht":"^6.6.1","standard":"^17.0.0","udx-native":"^1.6.1"},"_npmOperationalInternal":{"tmp":"tmp/blind-relay_1.4.0_1744483711261_0.4603992786207931","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":1744483711431,"_cnpm_publish_time":1744483711431,"dist-tags":{"latest":"1.6.1"}}