How does DHT in torrents work?

前端 未结 4 1421
傲寒
傲寒 2021-01-29 19:00

I\'m coding a p2p implementation that I would like to make decentralized however I\'m having some trouble grasping how DHT in protocols like bittorrent work. How does the client

4条回答
  •  时光取名叫无心
    2021-01-29 19:02

    DHT nodes have unique identifiers, termed, Node ID. Node IDs are chosen at random from the same 160-bit space as BitTorrent info-hashes. Closeness is measured by comparing Node ID's routing tables, the closer the Node, the more detailed, resulting in optimal

    What then makes them more optimal than it's predecessor "Kademlia" which used simple unsigned integers: distance(A,B) = |A xor B| Smaller values are closer. XOR. Besides not being secure, its logic was flawed.

    If your client supports DHT, there are 8-bytes reserved in which contains 0x09 followed by a 2-byte payload with the UDP Port and DHT node. If the handshake is successful the above will continue.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题