Wednesday, August 5, 2015

hetimatorrent support mainline dht (bep5) for dart developer

Kyorohiro work announce that  hetimatorrent library for dart developer support mainline dht (bep5).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
a() {
  KNode node = new KNode(new HetiSocketBuilderChrome(), verbose: true);
  String localIp = "0.0.0.0";
  int localPort = 28080;
  //
  //
  node.start(ip: localIp, port: localPort).then((_) {
    node.onGetPeerValue.listen((KGetPeerValue v) {
      print("---onGetPeerValue ${v.ipAsString} ${v.port} ${v.infoHashAsString} ");
    });
  });

  //
  // initial node
  String initailNodeIp = "0.0.0.0";
  int initailNodePort = 38080;
  node.addBootringNode(initailNodeIp, initailNodePort);
  
  //
  // search target
  List<int> infoHash = new List.filled(20, 4);
  node.startSearchValue(new KId(infoHash), 18080, getPeerOnly: true);
  
  new Future.delayed(new Duration(minutes:30)).then((_){
    print(node.rootingtable.toInfo());
    return node.stop();
  });

}

The hetimatorremt library is torrent library with pure dart for dart developer. and hetimatorrent library is pre-Alpha version, not stable now.

now support chrome application only. hetimatorrent socket use hetimanet socket. hetimanet socjket is highly abstracted interface. kyorohiro work will be nearly support webrtc, dart:io etc.

What is DHT?

When introduce a node that was joined in a p2p network,  a DHT support node build and join a this p2p network. after few seconds, several times of inquiry,  this node will be able to find data from p2p network.

Source

- hetimatorrent
  https://github.com/kyorohiro/dart_hetimatorrent
- heitnanet
  https://github.com/kyorohiro/dart_hetimanet
- dht sample
  https://github.com/kyorohiro/dart_hetimatorrent/tree/master/example/TorrentDHT
- bep5
 http://www.bittorrent.org/beps/bep_0005.html
- Kademlia; A Peer-to-peer Information System Based on the XOR Metric.
 http://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf


-------
Kyorohiro work


No comments:

Post a Comment