-
Notifications
You must be signed in to change notification settings - Fork 491
Closed
Labels
P1High: Likely tackled by core team if no one steps upHigh: Likely tackled by core team if no one steps upexp/wizardExtensive knowledge (implications, ramifications) requiredExtensive knowledge (implications, ramifications) requiredstatus/in-progressIn progressIn progress
Description
Some libp2p modules require or would benefit from knowing the peerId
and other values. It happens that, at the time the declarative options are created, the peerId is not yet known. As an example, libp2p-websocket-star would require the PeerId
object to prevent spoofing. It happens that this value is not known before boot.
Here I propose a modules definition form that is backwards compatible and can be summed up to:
If a module is a function, libp2p assumes it is a constructor and executes that function, which should return a the module instance.
This would allow to declare config like this:
{
modules: {
transport: [
wrtcStar // instance,
({peerId}) => new WSStar({id: peerId})
]
}
}
Metadata
Metadata
Assignees
Labels
P1High: Likely tackled by core team if no one steps upHigh: Likely tackled by core team if no one steps upexp/wizardExtensive knowledge (implications, ramifications) requiredExtensive knowledge (implications, ramifications) requiredstatus/in-progressIn progressIn progress