Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 710 Bytes

README.md

File metadata and controls

40 lines (31 loc) · 710 Bytes

Kad Consistency

Extension with simple consistency checks for Kad.

Usage

Install with NPM.

npm install kad kad-consistency

Integrate with your Kad project.

var kad = require('kad');
var consistency = require('kad-consistency');
var Node = consistency.ConsistentNode(kad.Node);

var seed = {
  address: '127.0.0.1',
  port: 1338
};

var dht = new Node({
  transport: kad.transports.UDP(kad.contacts.AddressPortContact({
    address: '127.0.0.1',
    port: 1337
  })),
  storage: kad.storage.FS('path/to/datadir')
});

dht.connect(seed, function(err) {
  // dht.get(key, callback);
  // dht.put(key, value, callback);
});