Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding Peer and content #344

Closed
hubertokf opened this issue Mar 27, 2019 · 3 comments
Closed

Finding Peer and content #344

hubertokf opened this issue Mar 27, 2019 · 3 comments
Labels
kind/stale kind/support A question or request for support

Comments

@hubertokf
Copy link

hubertokf commented Mar 27, 2019

  • 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

@hubertokf
Copy link
Author

hubertokf commented Mar 28, 2019

I bet my problem is on bootstrapers list. When I run my n5 node, n7 nor n5 gives connection message, just discovery.

How can i define my node addres, I mean: /ip4//tcp//<ipfs ?>/
ok, i can get network-ip, but which port it uses?

@jacobheun jacobheun added the kind/support A question or request for support label Mar 28, 2019
@jacobheun
Copy link
Contributor

ok, i can get network-ip, but which port it uses?

TCP will replace the addresses of node.peerInfo.multiaddrs when it starts. So if you wait for the node to start you should be able to get a list of its up to date addresses from there.

How can i define my node addres, I mean: /ip4//tcp//<ipfs ?>/

These are being added via libp2p-rpc, https://github.com/hubertokf/libp2p-rpc/blob/36ac829628e8193d4e7a140fd387e79e438bf4c3/index.js#L73-L74. Once libp2p starts node.peerInfo.multiaddrs will have all of your addresses.

You are likely having a connection issue. Either the nodes you need aren't actually connected, or peer discovery is happening before they are.

Libp2p currently doesn't dial to peers it discovers (unless it's actively crawling the DHT), so you will need to add the dial logic on the peer discovery event.

@wemeetagain
Copy link
Member

Closing stale issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/stale kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

4 participants