go-textile icon indicating copy to clipboard operation
go-textile copied to clipboard

Difficult to `contacts add` if peers are not directly connected

Open flyskywhy opened this issue 6 years ago • 1 comments

With go-textile_v1.0.0-rc51_linux-amd64.tar.gz

On computer A (behind a NAT) and computer B (behind a NAT)

$ textile ipfs swarm connect /ip4/18.184.60.108/tcp/4001/ipfs/QmQUPL5gvWp3VDBrouhpZx2L6un2ZBzMbLmcnjK45TMuVv
[
    "connect QmQUPL5gvWp3VDBrouhpZx2L6un2ZBzMbLmcnjK45TMuVv success"
]

then

On computer A

$ textile ipfs swarm connect /ipfs/QmQUPL5gvWp3VDBrouhpZx2L6un2ZBzMbLmcnjK45TMuVv/p2p-circuit/ipfs/12D3KooWP3u4Hyg2to92K9X9Ke5naLcRbgE5njCr5ybtJs3F3ybT
[
    "connect 12D3KooWP3u4Hyg2to92K9X9Ke5naLcRbgE5njCr5ybtJs3F3ybT success"
]

BTW, 12D3KooWP3u4Hyg2to92K9X9Ke5naLcRbgE5njCr5ybtJs3F3ybT comes from ~/.textile/repo/config PeerID of computer B

I can confirm computer A and B is connected with relay peer /ip4/18.184.60.108/tcp/4001/ipfs/QmQUPL5gvWp3VDBrouhpZx2L6un2ZBzMbLmcnjK45TMuVv by

textile ipfs swarm peers | grep QmQUPL5gvWp3VDBrouhpZx2L6un2ZBzMbLmcnjK45TMuVv -A3

but when I run on computer A

textile contacts add -p 12D3KooWP3u4Hyg2to92K9X9Ke5naLcRbgE5njCr5ybtJs3F3ybT
No contacts were found

when I run it in many times about 20 times, there will be a

Add 1 contact? [y/n]: n

On computer C (public, not behind a NAT) and computer D (public, not behind a NAT), if I did not textile ipfs swarm connect them directly, textile contacts add will No contacts were found

In terminal 1 and terminal 2 (repo use .textile2) On computer E, textile contacts add even invites and chat works well with the two terminal.

So why contacts add is so difficult on different computers? Because relay connected not directly connected?

flyskywhy avatar Mar 12 '19 07:03 flyskywhy

Hmm, they shouldn't need to be direct connected. Search works via gossipsub for this very reason. I'll have to investigate further.

sanderpick avatar Mar 12 '19 16:03 sanderpick