Node.JS-LibP2P Public Node Listening On WebRTC-Direct?

Hello,

I’ve spent a few days, off and on trying to figure out why I can’t seem to get my node.js-libp2p node to advertise a webrtc listening multiaddr. Just a discussion over in the IPFS discord with another new dev who pointed me to this pull request.

At the top, the dev states that “Listening private-to-public” is not supported, and I’m just kinda wondering why that might be? Is there something technically limiting about node.js that prevents this?

My node.js-libp2p node’s config looks like this:

const libp2p = await createLibp2p({
    peerId,
    addresses: {
        listen: [
            '/ip4/0.0.0.0/tcp/0/ws',
            '/ip4/0.0.0.0/tcp/0',
            '/ip4/0.0.0.0/udp/0/webrtc-direct',
            '/webrtc'
        ]
    },
    transports: [
        tcp(),
        webSockets(),
        webTransport(),
        webRTC(),
        webRTCDirect(),
        circuitRelayTransport({
            discoverRelays: 1
        })
    ],
    connectionEncryption: [noise()],
    streamMuxers: [yamux(), mplex()],
    peerDiscovery: [
        bootstrap({
            list: [
                '/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN',
                '/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb',
                '/dnsaddr/bootstrap.libp2p.io/p2p/QmZa1sAxajnQjVM8WjWXoMbmPd7NsWhfKsPkErzpm9wGkp',
                '/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa',
                '/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt'
            ]
        }),
        mdns()
    ],
    services: {
        identify: identifyService(),
        relay: circuitRelayServer(),
        dht: kadDHT()
    },
    relay: {
        enabled: true,
        hop: {
          enabled: true
        }
    }
})

Could anyone tell me if this is something that is in the works, but not quite there yet, or is just gonna be doable in node.js? I’m already starting to play a bit with a rust implementation in the meantime because I know it’s capable of what I’m trying to do, but just wanted to stick with JS/TS if I could.

Hi @eru, mind posting this here libp2p/js-libp2p Q A · Discussions · GitHub

1 Like