rs-ipfs/rust-ipfs

libp2p NetworkBehaviour implementation is not extensible.

cobward opened this issue · 0 comments

In the current state this crate cannot be used to build any application on top of IPFS. We have a use-case which requires private swarms, custom authentication between peers and additional network behaviour. The implementation of NetworkBehaviour in this crate is not extensible in its current form, so there are limitations on how we can use this crate to implement the behaviour we need.

We would require that the Behaviour struct is extended with an optional custom field, which can be supplied to extend the behaviour of the swarm. This custom behaviour should have high-level access to IPFS methods. It should be possible to construct an IPFS instance using this behaviour, but as much as possible construction of a vanilla IPFS instance should not be compromised.

I had previously considered exposing a method on UninitialisedIpfs to allow the declaration of a SwarmEvent handler which would be called within the main loop of IpfsFuture. This was possible, but I felt it would not be very user-friendly, and not in the spirit of libp2p.

I have a WIP which I will raise as a PR soon, but if anyone has comments or feedback before I do so I will take them on board.