Tuesday, August 11, 2015

Let's coding mainline dht.(4) build p2p network at findNodes query

My English skill is poor. If I make mistakes in my English,please pardon me.

Build p2p betwork at FindNode query

  • Build p2p network to use only FindNodes query
  • Update routingtable to receive a response.
I explained about kBucket Rooting table in previous section.  In this section, We build p2p network to update rooting table.


Could build network by findnodes qurey

Mainline DHT(Kademlia) use UDP socket to communicatio other peer.
P2P network is building to use only findnodes qurey.

Could find close distance peer from the specified KID

We use FindNode query,  We could find close distance peer from the specified KID.

findnodes query and response have following structure.
 arguments:  
 {  
  "t":"aa",  
  "y":"q",  
  "q":"find_node",  
  "a":{  
  "id" : "<nodes id>",  
  "target" : "<id of target node>"  
  }  
 }  
 response:  
 {  
  "t":"aa",  
  "y":"r",  
  "r":{  
  "id" : "<nodes id>",  
  "nodes" : "<compact node info>"  
  }  
 }  

"t" is specified string. that any sender can be determined.this value use when receive response.

"id" is sender peer's peer Id
"target" findnode querry return peers that the distance is close.
"nodes" is 26byte byte data list. this data have 20byte Peer ID, and IP, and port,

Join/Build p2p network.

It is updating rooting table to use findnodes query that "id" is own peer id.
repeat to request findnodes query until k-number of close peer is no longer update.

following table is a peer 's rooting table on simulator use 1000 peer.
Rooting Table indexnumner of Peercomment
01own
1471..
1541..
1554..
1564..
1576..
1588..
1598..
1608..

Become same result If try this in torrent 's dht network .

147 is very close node.

Ref


- GitBook Nazenani Torrent for japanese


- kyorohiro work torrent library and dht demo


-------
Kyorohiro work

No comments:

Post a Comment