Closed spikebike closed 10 years ago
Are you passing true in the argument to PeersRequest?
http://godoc.org/github.com/nictuku/dht#DHT.PeersRequest On Oct 8, 2014 11:12 AM, "Bill Broadley" notifications@github.com wrote:
I wanted to test a very simple IPv4 DHT. I took 2 ubuntu 14.04 boxes with go-1.3.1 and said go get github.com/nictuku/dht. Lets call them left (192.168.1.2), and right (192.168.1.3). I hard coded both to port 8444. On left/192.168.1.2: Port: 8444, // 0 Picks a random port. DHTRouters: "192.168.1.3:8444",
On right/192.168.1.3: Port: 8444, // Picks a random port. DHTRouters: "192.168.1.2:8444",
If passed in the same infohash I expected them to find each other, and then accept each other as peers. I ran both copies with: $ go run main.go -log_dir="log" -v=6 12b9b08b325e877d08cc63a75e8fd24699c3dc6b
In the log left did ok: I1008 01:46:31.709372 29590 dht.go:233] DHT: torrent client asking more peers for 12b9b08b325e877d08cc63a75e8fd24699c3dc6b. I1008 01:46:31.709727 29590 dht.go:572] DHT: ping => {IP:192.168.1.3 Port:8444 Zone:} I1008 01:46:31.709739 29590 krpc.go:92] newQuery for , lastID 1 I1008 01:46:31.709743 29590 krpc.go:95] ... new id 2 I1008 01:46:31.709798 29590 dht.go:326] DHT: Starting DHT node 4fc01e6d67478cb3b959b50c66b87b6ee11a9dbd on port 8444. I1008 01:46:31.710378 29590 dht.go:445] DHT processing packet from 192.168.1.3:8444 I1008 01:46:31.710404 29590 dht.go:465] DHT processing response from 7e6738648a6d2153d779c4b52924c407b3c6bf87 I1008 01:46:31.710413 29590 dht.go:495] DHT: Received reply to ping I1008 01:46:31.710419 29590 routing_table.go:276] New neighbor added to neighborhood with proximity 2
Right took longer but: I1008 01:46:25.598368 23507 dht.go:188] Using a new random node ID: 7e6738648a6d2153d779c4b52924c407b3c6bf87 20 I1008 01:46:25.599059 23507 dht.go:233] DHT: torrent client asking more peers for 12b9b08b325e877d08cc63a75e8fd24699c3dc6b. I1008 01:46:25.599278 23507 dht.go:572] DHT: ping => {IP:192.168.1.2 Port:8444 Zone:} I1008 01:46:25.599320 23507 krpc.go:92] newQuery for , lastID 1 I1008 01:46:25.599330 23507 krpc.go:95] ... new id 2 I1008 01:46:25.599408 23507 dht.go:326] DHT: Starting DHT node 7e6738648a6d2153d779c4b52924c407b3c6bf87 on port 8444. ... I1008 02:01:25.647747 23507 dht.go:445] DHT processing packet from 192.168.1.2:8444 I1008 02:01:25.647780 23507 dht.go:465] DHT processing response from 4fc01e6d67478cb3b959b50c66b87b6ee11a9dbd I1008 02:01:25.647798 23507 dht.go:495] DHT: Received reply to ping I1008 02:01:25.647809 23507 routing_table.go:276] New neighbor added to neighborhood with proximity 2 I1008 02:01:25.647818 23507 routing.go:223] wasContactedRecently for ih=7e6738648a6d2153d779c4b52924c407b3c6bf87 in node 4fc01e6d67478cb3b959b50c66b87b6ee11a9dbd@{192.168.1.2 8444 } returned false
So there's connectivity (and no firewalls involved) between left and right, they are exchanging UDP packets, and they have accepted each other as neighbors.
However they never accept each other as peers for the same infohash. So no match on stdout, and while totalNodes and totalNodesReached sits at 1, totalPeers stays at zero.
Is this too simple of a DHT (just 2 nodes)? Am I misunderstanding something?
— Reply to this email directly or view it on GitHub https://github.com/nictuku/dht/issues/31.
Ha. It didn't occur to me the example wouldn't work against itself, thanks.
Excellent, this fixes my IPv6 version as well. On my 2 test nodes:
Peers found: 0: [2601:c:a200:1248:76d0:2bff:fe90:8b90]:8444
Peers found: 0: [2601:c:a200:1248:f66d:4ff:fe18:69d2]:8444
Promising, very promising.
I wanted to test a very simple IPv4 DHT. I took 2 ubuntu 14.04 boxes with go-1.3.1 and said go get github.com/nictuku/dht. Lets call them left (192.168.1.2), and right (192.168.1.3). I hard coded both to port 8444. On left/192.168.1.2: Port: 8444, // 0 Picks a random port. DHTRouters: "192.168.1.3:8444",
On right/192.168.1.3: Port: 8444, // Picks a random port. DHTRouters: "192.168.1.2:8444",
If passed in the same infohash I expected them to find each other, and then accept each other as peers. I ran both copies with: $ go run main.go -log_dir="log" -v=6 12b9b08b325e877d08cc63a75e8fd24699c3dc6b
In the log left did ok: I1008 01:46:31.709372 29590 dht.go:233] DHT: torrent client asking more peers for 12b9b08b325e877d08cc63a75e8fd24699c3dc6b. I1008 01:46:31.709727 29590 dht.go:572] DHT: ping => {IP:192.168.1.3 Port:8444 Zone:} I1008 01:46:31.709739 29590 krpc.go:92] newQuery for , lastID 1 I1008 01:46:31.709743 29590 krpc.go:95] ... new id 2 I1008 01:46:31.709798 29590 dht.go:326] DHT: Starting DHT node 4fc01e6d67478cb3b959b50c66b87b6ee11a9dbd on port 8444. I1008 01:46:31.710378 29590 dht.go:445] DHT processing packet from 192.168.1.3:8444 I1008 01:46:31.710404 29590 dht.go:465] DHT processing response from 7e6738648a6d2153d779c4b52924c407b3c6bf87 I1008 01:46:31.710413 29590 dht.go:495] DHT: Received reply to ping I1008 01:46:31.710419 29590 routing_table.go:276] New neighbor added to neighborhood with proximity 2
Right took longer but: I1008 01:46:25.598368 23507 dht.go:188] Using a new random node ID: 7e6738648a6d2153d779c4b52924c407b3c6bf87 20 I1008 01:46:25.599059 23507 dht.go:233] DHT: torrent client asking more peers for 12b9b08b325e877d08cc63a75e8fd24699c3dc6b. I1008 01:46:25.599278 23507 dht.go:572] DHT: ping => {IP:192.168.1.2 Port:8444 Zone:} I1008 01:46:25.599320 23507 krpc.go:92] newQuery for , lastID 1 I1008 01:46:25.599330 23507 krpc.go:95] ... new id 2 I1008 01:46:25.599408 23507 dht.go:326] DHT: Starting DHT node 7e6738648a6d2153d779c4b52924c407b3c6bf87 on port 8444. ... I1008 02:01:25.647747 23507 dht.go:445] DHT processing packet from 192.168.1.2:8444 I1008 02:01:25.647780 23507 dht.go:465] DHT processing response from 4fc01e6d67478cb3b959b50c66b87b6ee11a9dbd I1008 02:01:25.647798 23507 dht.go:495] DHT: Received reply to ping I1008 02:01:25.647809 23507 routing_table.go:276] New neighbor added to neighborhood with proximity 2 I1008 02:01:25.647818 23507 routing.go:223] wasContactedRecently for ih=7e6738648a6d2153d779c4b52924c407b3c6bf87 in node 4fc01e6d67478cb3b959b50c66b87b6ee11a9dbd@{192.168.1.2 8444 } returned false
So there's connectivity (and no firewalls involved) between left and right, they are exchanging UDP packets, and they have accepted each other as neighbors.
However they never accept each other as peers for the same infohash. So no match on stdout, and while totalNodes and totalNodesReached sits at 1, totalPeers stays at zero.
Is this too simple of a DHT (just 2 nodes)? Am I misunderstanding something?