js-ipfsd-ctl
js-ipfsd-ctl copied to clipboard
how to provide a custom libp2p instance?
I expected something like this is going to work:
const customLibp2p = await createLibp2p({
addresses: {
listen: [`/ip4/127.0.0.1/tcp/8000/ws`],
},
transports: [new WebSockets()],
connectionEncryption: [new Noise()],
streamMuxers: [new Mplex()],
})
const ipfsd = await createController({
type: "go",
remote: false,
disposable: false,
ipfsHttpModule,
ipfsBin: goIpfsModule.path(),
ipfsOptions: {
EXPERIMENTAL: {
ipnsPubsub: true,
},
libp2p: customLibp2p, // NOTICE HERE PLEASE. IT LOOKS LIKE ITS BEING COMPLETELY IGNORED
repo: repoPath,
init: false,
start: false,
},
})
but "libp2p" option is being ignored. Maybe types are wrong and there is another way how to provide a custom libp2p instance implementation?
When the type
of the controller is go
we shell out to kubo which cannot use js-libp2p
in this fashion.
This could be improved by checking the value of ipfsOptions
and throwing an error if any options are passed that are incompatible with the style of daemon being created. The libp2p
option for example would only work with an in-proc daemon.
Would you like to submit a PR that improves this?
Because of this issue I had to switch to ipfs-core
for now. If I'll return back to this package, I'll consider to add this improvement. Thanks for your answer.
And what is the point to use proc
mode? If I can directly use js-ipfs
package? I'm trying to understand the motivation behind this option.
The point of this module is to be able to seamlessly switch between go, and js implementations, and for js as in-process or running as a separate process.
This is useful for testing compatibility between the different implementations.
If your only requirement is to have an IPFS node as part of your app, you should use ipfs-core directly.
Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.
This issue was closed because it is missing author input.