network-setup
Create network simulations to test your peers and connections using ngraph
Install
$ npm install @geut/network-setup
Usage
const { NetworkSetup, Peer, Connection } = require('@geut/network-setup')
// defines the generator
const setup = new NetworkSetup({
onPeer(node) {
// Creates a peer
return new Peer(node, {
// open/close are hooks to execute operations inside of peer lifecycle
async open() {},
async close() {}
})
},
onConnection(link, fromPeer, toPeer) {
return new Connection(link, {
// open/close are hooks to execute operations inside of connection lifecycle
async open() {},
async close() {}
})
}
})
;(async () => {
// Create a balanced binary tree with 3 levels
const network = await setup.balancedBinTree(3)
})()
Issues
Contributing
License
MIT © A GEUT project