Return to site

HetimaTorrent support mainline dht

test

HetimaTorrent supported mainlinedht. 
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();
  });
}
All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OKSubscriptions powered by Strikingly