{"name":"blind-relay","version":"1.3.3","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","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":"^2.12.0","compact-encoding-bitfield":"^1.0.0","hypertrace":"^1.4.1","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"},"_id":"blind-relay@1.3.3","gitHead":"11801acdf9e4cf1dfcbba930c5b36ce3022e0431","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-J49HZaRLA+jgmIA+J01x0NzDtNMQVzuFfz7CnLLijIUMJkxTbaexIGI/tfk6LONcr/+INmgbS8gMLeuaRvfreA==","shasum":"b9460fac1c2e8a8a326dbbb827b8c00339ed729f","tarball":"http://registry-npm.ywwl.com/blind-relay/download/blind-relay-1.3.3.tgz","fileCount":5,"unpackedSize":26699,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFuCxlAFRNa8p1Y5mq4uK+vgoxmVYmNYRlFLEupFQivjAiA4GnnfOz9fgAGIrK9HIWnXxxrd8hTPIewl/ETjOtSgpw=="}],"size":7785,"noattachment":false,"key":"/blind-relay/-/blind-relay-1.3.3.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"kasperisager","email":"kasperisager@hey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/blind-relay_1.3.3_1710316577739_0.3186057506406257"},"_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":1710316577894,"_cnpm_publish_time":1710316577894,"dist-tags":{"latest":"1.6.1"}}