{"name":"blind-relay","version":"1.3.1","description":"Blind relay for UDX over Protomux channels","main":"index.js","scripts":{"test":"standard && brittle 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","dependencies":{"b4a":"^1.6.4","bits-to-bytes":"^1.3.0","compact-encoding":"^2.12.0","compact-encoding-bitfield":"^1.0.0","protomux":"^3.5.1","sodium-universal":"^4.0.0","streamx":"^2.15.1"},"devDependencies":{"brittle":"^3.2.1","hyperdht":"^6.6.1","standard":"^17.0.0","udx-native":"^1.6.1"},"gitHead":"d045199bb5fbd9c1f7d575e84fcda30b47e9891c","_id":"blind-relay@1.3.1","_nodeVersion":"20.4.0","_npmVersion":"9.7.2","dist":{"integrity":"sha512-GNOCAQG76WvN8e1k4C8UyQgfpSl8h2NiUgr6aFQJY/WKISvsU1flG0o3TJoUGn5K9uvtbEUtdulgikS1aYKbAQ==","shasum":"d046c749d45e60760a3bcfeec13670c15260db0b","tarball":"http://registry-npm.ywwl.com/blind-relay/download/blind-relay-1.3.1.tgz","fileCount":5,"unpackedSize":24965,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGoGGIBPNkBkl56SUAIicxN2INtdq9SFZ9jY6ybgBGPWAiEA2XYK78xkLSYyOPjssWlbquelf9d8F7BBqIN5v1FocOk="}],"size":7424,"noattachment":false,"key":"/blind-relay/-/blind-relay-1.3.1.tgz"},"_npmUser":{"name":"kasperisager","email":"kasperisager@hey.com"},"directories":{},"maintainers":[{"name":"kasperisager","email":"kasperisager@hey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/blind-relay_1.3.1_1696490076762_0.1693869760041673"},"_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## License\n\nApache-2.0\n","publish_time":1696490077029,"_cnpm_publish_time":1696490077029,"dist-tags":{"latest":"1.6.1"}}