Skip to content

Node cannot dial to another using peer ID in a network connected via a relay. #2815

Answered by achingbrain
SpringMagnolia asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry for not answering this sooner. There was an undocumented optimisation in go-libp2p-dht that wasn't implemented here around searching for DHT client peers which has since been shipped.

I have made a few changes to your code to make it work:

  • server

    • add identifyPush service - this is so when node1 gets a circuit relay address, it can notify connected peers (e.g. the server) that it's addresses have changed
  • node1

    • listen on /p2p-circuit instead of specifying discoverRelays to circuit relay transport
  • node2

    • removed discoverRelays as it's not necessary for node2 to listen on any address

Updated code:

package.json

{
  "type": "module",
  "dependencies": {
    "@chainsafe/libp2p…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SpringMagnolia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants