Hello everyone !
I’m trying to run an application using ipfs-core@0.11.1
and I’m very confused. I read many times that I can override libp2p configuration by setting a libp2p
property in the IPFS creation function arguments. I need to create a configuration for a private network, and it works well with the relay peer on go-ipfs
. But when I try to run my app with the LIBP2P_FORCE_PNET=1
environment variable, the app crashes with the following error :
Private network is enforced, but no protector was provided
…even if in my configuration object I have a proper protector passed in the connProtector
property of the modules
configuration of LibP2P.
It seems that everytime, the libp2p
setting property is properly ignored, even if I create manually the libp2p object following this example : js-ipfs-examples/examples/custom-libp2p at master · ipfs-examples/js-ipfs-examples · GitHub.
I even tried with a little snippet and the results are the same :
const fs = require('fs')
const ipfs = require('ipfs-core')
const Protector = require('libp2p/src/pnet')
process.env.LIBP2P_FORCE_PNET = '1'
async function init () {
const node = await ipfs.create({
config : { Bootstrap : ['/ip4/<peerip>/tcp/4001/ipfs/<peerId>'] },
libp2p : { modules : { connProtector : new Protector(fs.readFileSync('/path/to/the/swarm.key')) } }
})
}
init().catch((err) => console.error(err))
Did you guys already have that kind of problem ?
[EDIT]
I’ve investigated and it seems that libp2p options are always passed as undefined
in the storage constructor of js-ipfs (and by debugging inside node_modules, it appears the error comes from there)
(and there’s also line 229 but as I’m new here I can’t post more than 2 links)
Am I crazy or am I looking at the wrong thing ? If some already succeed to use the js-ipfs programmatic interface with LIBP2P_FORCE_PNET to 1, I would like to know how you used that ?