libp2p / go-libp2p-examples

Example libp2p applications
MIT License
339 stars 145 forks source link

chat-with-rendezvous does not work #60

Open zmajew opened 5 years ago

zmajew commented 5 years ago

Hello, Thanks for go-libp2p! I am learnig how to use go-libp2p and I need your help to resolve problem I have with chat-with-rendezvous example. Here is cli messages I have:

12:19:50.724 INFO rendezvous: Host created. We are: <peer.ID QmnkLm3D> chat.go:107 12:19:50.724 INFO rendezvous: [/p2p-circuit /ip4/127.0.0.1/tcp/6666] chat.go:108 12:19:50.728 WARNI dht: error bootstrapping: failed to find any peer in table dht_bootstrap.go:86 12:19:50.766 WARNI rendezvous: dial attempt failed: no good addresses chat.go:139 12:19:50.766 WARNI rendezvous: dial attempt failed: no good addresses chat.go:139 12:19:50.767 WARNI rendezvous: dial attempt failed: no good addresses chat.go:139 12:19:50.768 WARNI rendezvous: dial attempt failed: no good addresses chat.go:139 12:19:51.155 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmVQKNAd> [/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001]} chat.go:141 12:19:51.155 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmVQKNAd> [/ip4/178.62.158.247/tcp/4001]} chat.go:141 12:19:51.803 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmzaDs64> [/ip4/104.236.76.40/tcp/4001]} chat.go:141 12:19:51.803 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmzaDs64> [/ip6/2604:a880:800:10::4a:5001/tcp/4001]} chat.go:141 12:19:52.513 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmL1KrGM> [/ip4/104.236.179.241/tcp/4001]} chat.go:141 12:19:52.513 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmL1KrGM> [/ip6/2604:a880:1:20::203:d001/tcp/4001]} chat.go:141 12:19:53.334 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmwMKPnu> [/ip6/2400:6180:0:d0::151:6001/tcp/4001]} chat.go:141 12:19:53.334 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmwMKPnu> [/ip4/128.199.219.111/tcp/4001]} chat.go:141 12:20:00.180 INFO rendezvous: Connection established with bootstrap node: {<peer.ID QmQLuvuJ> [/ip4/104.131.131.82/tcp/4001]} chat.go:141 12:20:00.180 INFO rendezvous: Announcing ourselves... chat.go:149 12:20:00.594 WARNI rendezvous: Connection failed: dial attempt failed: no good addresses chat.go:172 12:20:00.598 WARNI rendezvous: Connection failed: dial attempt failed: no good addresses chat.go:172 12:20:00.600 WARNI rendezvous: Connection failed: dial attempt failed: no good addresses chat.go:172 12:20:00.602 WARNI rendezvous: Connection failed: dial attempt failed: no good addresses chat.go:172 12:20:00.602 WARNI rendezvous: Connection failed: dial attempt failed: no good addresses chat.go:172 12:20:00.603 WARNI rendezvous: Connection failed: dial attempt failed: no good addresses chat.go:172 12:24:50.729 WARNI dht: error bootstrapping: failed to find any peer in table dht_bootstrap.go:86 12:29:50.746 WARNI dht: error bootstrapping: failed to find any peer in table dht_bootstrap.go:86 12:34:50.762 WARNI dht: error bootstrapping: failed to find any peer in table dht_bootstrap.go:86

I tried to add bootstrep node from my IPFS node config file like:

$ ./chat -listen /ip4/127.0.0.1/tcp/6666 -peer /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ

but it does not helped. What is the problem here? Thanks

tongxin97 commented 5 years ago

I just had the same issue. Seems like discovery.Advertise() failed. Changing the RendezvousString also does not help.

aschmidt75 commented 5 years ago

Had the same issue. Additionally, my output says "dht: Bad dht record"

14:07:14.039  INFO rendezvous: Connection established with bootstrap node: {<peer.ID Qm*wMKPnu> [/ip4/128.199.219.111/tcp/4001]} chat.go:141
14:07:14.039  INFO rendezvous: Connection established with bootstrap node: {<peer.ID Qm*wMKPnu> [/ip6/2400:6180:0:d0::151:6001/tcp/4001]} chat.go:141
14:07:43.141  INFO rendezvous: Connection established with bootstrap node: {<peer.ID Qm*QLuvuJ> [/ip4/104.131.131.82/tcp/4001]} chat.go:141
14:07:43.142  INFO rendezvous: Announcing ourselves... chat.go:149
14:08:22.286 WARNI net/identi: error reading identify message:  stream reset id.go:135
14:08:43.463 WARNI        dht: Bad dht record in PUT from: Qme9BMQX1rLaBRy8G3hQc9DuiB4vdP6KWz3mEFqmPqgWAd. invalid record keytype handlers.go:167
upperwal commented 5 years ago

Most of them are WARNINGS and you should not worry about them.

Warning like 12:19:50.728 WARNI dht: error bootstrapping: failed to find any peer in table dht_bootstrap.go:86 is generated because of random walk algorithm which generates random peer ID's and try to connect to them even before we are connected to any node and hence no peer is available in the routing table.

Warnings like

12:19:50.768 WARNI rendezvous: dial attempt failed: no good addresses chat.go:139

I guess because of DNS multiaddr bootstrap nodes like /dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN which are not yet supported by the swarm. @Stebalien might be able tell you more about this.

Example should work regardless of the warnings generated. (Tried)

I think it would be good not to display too many logs to someone who is new.