hyperpunch
Note, that the API is still under development so subject to changes
const { Client } = require('hyperpunch')
const c = new Client([
'bootstrap1.hyperdht.org',
'bootstrap2.hyperdht.org'
])
// to join the swarm and accept connections on a public key:
await c.join(keyPair)
c.on('connection', function (noiseStream) {
// emitted when a new connection is accepted
// noiseStream is a NoiseSecretStream instance
})
// to connect to a public key to
const noiseStream = c.connect(publicKey, localKeyPair)
noiseStream.on('open', function () {
console.log('stream is fully open')
})
noiseStream.write(Buffer.from('hello world'))