UCLA-IRL / ndn-workspace-solid

NDN workspace in Solid JS
https://ndn-workspace.web.app
ISC License
6 stars 15 forks source link

P2P connection support #8

Open zjkmxy opened 10 months ago

zjkmxy commented 10 months ago

Current PeerJS transport does not work with more than 2 peers due to Interest loop. Actually, the Forwarder class of NDNts is not a real forwarder at all, but simply a demultiplexer.

https://github.com/zjkmxy/ndn-workspace-solid/blob/dbb3c470b1fdc62c2a52a3cc78889a64686ebdd8/src/adaptors/peerjs-transport.ts#L8

To correctly use PeerJS transport without having Interest loop, we need to do one of the following:

Varun has implemented a face to support WebSocket broadcast: https://github.com/pulsejet/ndnts-ws It may also be ported.

yoursunny commented 10 months ago

Drop in some quick fix to the NDNts's "forwarder" so that it can surpress unsatisfied Interests

NDNts probably will never have a full featured forwarder as default, because it would significantly increase code size. I'd see whether I can provide hooks to customize certain parts of the forwarding logic.

Avoid Interests' being forwarded

NDNts can potentially offer an Interest forwarding filter option or FIB lookup hook. Sample API would look like one of these:

Forwarder.create({
  canForwardInterest(inFace: FwFace, outFace: FwFace, pkt: FwPacket<Interest>): boolean {
    return true;
  },
});

Forwarder.create({
  forwardInterest(inFace: FwFace, pkt: FwPacket<Interest>, lookupFIB: () => Iterable<FwFace>): Iterable<FwFace> {
    return lookupFIB();
  },
});

Let me know your thoughts.

Varun has implemented a face to support WebSocket broadcast: https://github.com/pulsejet/ndnts-ws

Browser side code copies each packet passing through the Forwarder to the WebSocket server; it does not correctly handle non-encodable messages such as RejectInterest and CancelInterest. I don't see how it's related to PeerJS or loop prevention.

zjkmxy commented 10 months ago

Browser side code copies each packet passing through the Forwarder to the WebSocket server; it does not correctly handle non-encodable messages such as RejectInterest and CancelInterest. I don't see how it's related to PeerJS or loop prevention.

@pulsejet Sorry. I have not been working on this for a while and I'm not aware of current progress. Maybe Varun can give more details.

pulsejet commented 10 months ago

Yes I expect there to be issues. This is more of a quick hack to emulate a broadcast medium; probably much better ways to do this.

Compile an in-browser forwarder using WASM.

I'd consider this to be the ideal solution.

zjkmxy commented 10 months ago

I'd consider this to be the ideal solution.

Now it is the time to pick up your old Rust NDN forwarder. (I'm joking)

zjkmxy commented 2 months ago

No plan to fix this for now. Maybe related: there was a NDN microforwarder in browser: 2nd-ndn-hackathon/firefox-micro-forwarder Poster paper: https://conferences2.sigcomm.org/acm-icn/2016/proceedings/p201-shang.pdf