js-libp2p
js-libp2p copied to clipboard
Implementation assumes tranpsorts inclue a discover
As per https://github.com/libp2p/js-libp2p/pull/802/files#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R648 implementation makes assumption that Transport includes a discovery but that assumption is not supported by the interface definition.
We should either iterate on an interface or an implementation so that assumptions made by the implementation are supported by the defined interface.
Regarding this, this will probably get into libp2p configuration improvements effort. This is not really interface related issue as the Transport Interface should not need to know about any discovery.
This is currently a hack that enables us to do:
const WebrtcStar = require('libp2p-webrtc-star')
const libp2p = await Libp2p.create({
modules: {
transport: [WebrtcStar]
}
})
Enabling its built in discovery. Webrtc-star is the only transport using this transport.discovery.
It should really go into discovery
const WebrtcStar = require('libp2p-webrtc-star')
const libp2p = await Libp2p.create({
modules: {
transport: [WebrtcStar],
peerDiscovery: [WebrtcStar]
}
})
But this currently is not possible, as we would need to construct WebrtcStar before, which requires libp2p's upgrader.
Closing due to staleness