hyperpunch

0.0.6 • Public • Published

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'))

/hyperpunch/

    Package Sidebar

    Install

    npm i hyperpunch

    Weekly Downloads

    2

    Version

    0.0.6

    License

    MIT

    Unpacked Size

    48.2 kB

    Total Files

    13

    Last publish

    Collaborators

    • mafintosh