Closed kulpreet closed 6 years ago
@kulpreet yeah, libp2p is nice, I have an implementation ready, but it has a few kinks such as not being able to serve a rpc connection (issue: https://github.com/hsanjuan/go-libp2p-gorpc/issues/12). Once that's done with, I'll put in a PR and we should be good.
Okay, so I was talking to a few folks from libp2p while trying to implement this and found a couple of things:
We need our own peer discovery thing if we are to use libp2p. For e.g say I have a URL like /ip4/<ip>/tcp/8001/ipfs/QmUsWKBMNckswS4gzTCYhTbwkv2cUBPSxShL6pEfnofnKN
and I want to connect to it, I have to write my own s tuff which actually looks up at that ip and says hey, I want to connect to this node. This defeats the point because you essentially need to write wrappers on top of something which we can assume should be done implicitly ie I need to be able to connect to you if I gave you the id and the ip.
The NAT traversal package seems to be not that well maintained, so some of the stuff may be incompatible with what we want
The entire process seems to be a drag: for eg. once you give an URL, I need to decode it and convert it into something which is known as a peerID
and then I have to use that peerID in order to call the ip and then connect.
libp2p can't make queries if both the server and the client are on the same host. So you need to pass in an ugly param along with lit-af
in order to make this run. Or store the local address somewhere and call it from that.
This being said, I do have a some what okayish implementation over at https://github.com/Varunram/lit/tree/libp2p. It doesn't get the rpc client right because I didn't want to write a "peer routing" protocol (as in ipfs). However if someone can build upon this and get NAT traversal (which is like the only bonus we'd get), that'd be good.
@Varunram what's the status on this? should we prioritize it or remove it?
@alindr I think it would be better we close this for now as libp2p doesn't seem to be a good fit into the current lit codebase.
Closing this by suggestion of @Varunram
Hi all,
On the spreadsheet listing projects for the L2 hackathon, I saw a suggestion of trying out libp2p for the p2p communication for lit. Also, on the road map (https://github.com/mit-dci/lit/issues/30), I saw a mention of NAT traversal and hole punching.
I wonder if there is any interest in this as importing libp2p goes against the "not invented here" syndrome pointed to in the contributions guidelines.
libp2p support a wide range of transports, so that might, or might not be handy.
libp2p does NAT traversal as best it could, I guess
For p2p encrypted connections, we could use the secio module from libp2p: https://github.com/libp2p/go-libp2p-secio
Finally, we tap into the wider community supporting the p2p layer for lit
Thoughts on trying libp2p, as an experiment?