How to use the libp2p-interfaces/src/topology.isTopology function in libp2p-interfaces

To help you get started, we’ve selected a few libp2p-interfaces examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github libp2p / js-libp2p / src / registrar.js View on Github external
register (topology) {
      'topology must be an instance of interfaces/topology')

    // Create topology
    const id = (parseInt(Math.random() * 1e9)).toString(36) +

    this.topologies.set(id, topology)

    // Set registrar
    topology.registrar = this

    return id