8000 GitHub - stevekeol/DHT: A simple implement of Kademlia DHT in Typescript
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

stevekeol/DHT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DHT

DHT的底层原理和实现思路

笔者正在制作DHT的动画视频,力图更精简,更易理解的阐明DHT的底层逻辑和实现机制;

DHT 是一个基于Typescript,网络无关的Distributed Hash TableKademlia算法和数据结构下的实现. 同时支持Node端和Web端.

在本地节点视角: DHT就像一个哈希表。提供了两个主要的操作 set(key, value)get(key) .

DHT中的D,即分布式,是说这些键值对是存储在互联的节点网络中的.

值的一提的是,此处的DHT将网络层的RPC留给用户或第三方库.

TODO

  • the handling of time-driven behaviors: key/value pairs expiration, bucket refresh, replication, and pairs republish.

  • 时间驱动行为的处理: 键值对到期,桶刷新,复制,键值对的重新发布

  • an implementation of the Rpc usable out-of-the-box (it will be done as a separate library) even though it's possible to use your own already;

  • 一个现成可用的RPC的实现

TODO - 第一里程碑

DHT(TS版)通过examples中的demo

  • 选取vite, rollup, webpack等工具,使得DHT编译打包后适合Node端和Web端(参考bcoin在这块儿的实现)(ts.config.js中配置即可)
  • 先把各个模块的类型代码就写在对应文件中,后期再解耦隔离
  • 后面尝试将一些配置性的参数,从文件中移除(如id.js中的BIT_SIZE等)

TODO - 第二里程碑

参考业界优秀论文,改进代码

  • 以TS中优秀精简的写法重构代码;

TODO - 第三里程碑

要不,参考下 ipfs

  • 提供Random Walk服务;
  • 提供Peer Discovery服务;
  • 提供Content Routing服务;
  • 提供Peer Routing服务;

About

A simple implement of Kademlia DHT in Typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0