dat-gateway icon indicating copy to clipboard operation
dat-gateway copied to clipboard

Provide discovery-swarm over WS

Open RangerMauve opened this issue 6 years ago • 0 comments

I think the gateway would be way more useful (and potentially more private) if instead of provoding WS for replicating a hyperdrive, it provided a WS interface to discovery-swarm.

I'm thinking this should be built as a separate module first.

  • It shouldn't reveal peer IP addresses
  • It should work over a stream.
  • All peer connections should be multiplexed over the single stream
  • Have the constructor take a discovery-swarm instance and return a handleStream(stream) listener. (or something like that)
  • It should use protocol buffers for an RPC API
    • join(discoveryKey) -> To the gateway
    • leave(discoveryKey) -> To the gateway
    • peer(discoveryKey, peerId) -> From the gateway
    • connect(peerId, streamId) -> To the gateway
    • disconnect(peerId, streamId) -> To the gateway
    • data(peerId, streamId, data) -> Either way

The client-side should take a stream as an argument and expose the same API as discovery-swarm

RangerMauve avatar Jun 22 '18 19:06 RangerMauve