Closed MarcoPolo closed 3 weeks ago
Another option would be to provide libp2p options to users who rely on FX as well, but instead of libp2p controlling the fx.New
and the user supplying FX options to libp2p, the libp2p provides itself as an option that users can import and inject into their fx.New
and dep graph.
Another option would be to provide libp2p options to users who rely on FX as well, but instead of libp2p controlling the
fx.New
and the user supplying FX options to libp2p, the libp2p provides itself as an option that users can import and inject into theirfx.New
and dep graph.
Yes. I'm working on this as well. It will appear as effectively a new constructor. This option allows hooking into the existing constructor. Long term, providing FX options is a lot more modular and where I want to end up.
Would Celestia be interested in trying that API? Useful for me to gauge interest here :)
While doing some refactoring of the p2p-forge client, I found that I wanted a way to get access to parts of the host earlier than
.New()
returning. I also wanted an option I could provide the constructor that would give me the host (or peer.ID, or something else) without having to have the user explicitly pass it to me.In other words I think it's nicer to do this:
Rather than
And this change would enable the former (along with many other things as well).
The biggest downside here is that fx is really powerful and this could cause some confusing errors to users.
Another concern is that it ties us to fx as long as we support this option. But I'm not worried about this for two reasons: