Skip to content

Finding Peer and content #344

@hubertokf

Description

@hubertokf
  • Version: "^0.24.4"
  • Platform: Linux core-VirtualBox 4.18.0-16-generic Update standard to version 7.1.2 🚀 #17~18.04.1-Ubuntu SMP Tue Feb 12 13:35:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: libp2p-kad-dht ( ^0.14.9 )

Type: Question

Severity: High (probably just a wrong idea or a miss code)

Description:

This is my scenario:
Got two distinct Networks, conected by a router. Running on Core emulator as you can see on this image:
image

Each host has one node running, where n4 can discover n5 using libp2p-mdns AND n5 can discover n7 using libp2p-bootstrapers.

What i'm trying is to make n4 find n7 using n5, like is saying on this libp2p example.

Actually, in this example, node1 has access to node3 peerInfo, but in my case I dont have. So once I know n7 ID, I can create peerID manually on n4 using:
peerid = PeerId.createFromB58String("<string id from n7>")
then find peer using:

node.peerRouting.findPeer(peerid, (err, peer) => {
                if (err) { throw err }
            
                console.log('Found it, multiaddrs are:')
                peer.multiaddrs.forEach((ma) => console.log(ma.toString()))
            })

What happens then is "Error: No peer found".
image
The order of execution is: n7, n5, n4
If you want, the code can be found here on teste1.js (n4), teste2.js (n5) and teste3.js (n7)

I'm using libp2p-rpc from my fork, where i'm updating this lib to work with newer version of libp2p.

Well, I don't know if i'm making mistakes, or if what i want is actually possible. Thats why i'm asking for help. Maybe you can guide me through this.

EDIT: I've tried using contentRouting.findProviders, but no success aswell.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions