uhthomas / pastry

The Pastry DHT written in Go. https://freepastry.org
GNU General Public License v3.0
6 stars 2 forks source link

Feature Request: Switch To Multiaddrs and LibP2P #3

Open bonedaddy opened 5 years ago

bonedaddy commented 5 years ago

In part spurred by https://github.com/uhthomas/pastry/issues/2, but also due to my personal liking of multiformats+libp2p.

Currently pastry is limited to quic transports. In cases like #2 this means the library will simply not function at all. Additionally this means adding new transports, and addressing capabilities is a non-trivial task.

Multiformats, in particular go-multiaddr when combined with libp2p see transport interface typos enable using a multitude of different addressing capabilities (ipv4, ipv6, onion, garlic, etc..) and a multitude of different transport options like:

If LibP2P were supported, then #2 wouldn't necessarily be a problem, since we can enable multiple different transports seamlessly.

I can add support for libp2p+multiformats if desired.

uhthomas commented 5 years ago

I really like this idea! I was actually toying with it last night, something akin to

type Listener interface{
    Accept() (Conn, error)
}

type Conn interface{
    Accept() (io.ReadWriteCloser, error)
    Open() (io.ReadWriteCloser, error)
    io.Closer
}

The use of libp2p sounds quite promising and as long as it's possible to mux connections, I see no problem with this. Would make the package a lot more flexible and extensible also.

bonedaddy commented 5 years ago

LibP2P includes a variety of muxers so that's a yes :)

uhthomas commented 5 years ago

I'd be very keen to implement these into pastry, if you have some spare time then I'd be very grateful. I'll be working on getting the routing tables, leafsets, etc right this week.

bonedaddy commented 5 years ago

Yep! I can get started on that tonight. edit: got started on this here https://github.com/RTradeLtd/pastry/tree/libp2p