npm.io
2.0.5 • Published 6 years ago

disco-star

Licence
MIT
Version
2.0.5
Deps
7
Size
17 kB
Vulns
2
Weekly
0

DiscoStar

Leofcoin peer discovery server

usage

import DiscoStar from 'disco-star';

const star = await new DiscoStar({protocol, port}, credentials);

star.parseAddress('0.0.0.0/5000/disco-room/id') // {address, port, protocol, peerId}

star.getPeerAddress('peerId', { 
  address: '0.0.0.0', port: 5000, protocol: 'disco-room'
}) // '0.0.0.0/5000/disco-room/peerId'

star.isDomain('0.0.0.0') // false
star.isDomain('example.com') // true

star.addressBook // ['address/port/protocol/peerId', ...]
star.peerId // 
star.port //
star.address //
star.interval //

config

{
  discovery: {
    peers: ['star.leofcoin.org/5000/disco-room/3tr3E5MNvjNR6fFrdzYnThaG3fs6bPYwTaxPoQAxbji2bqXR1sGyxpcp73ivpaZifiCHTJag8hw5Ht99tkV3ixJDsBCDsNMiDVp']
    star: {
      port: 5000,
      protocol: 'disco-room',
      interval: 10000
    }
  },
  identity: {
    peerId: 'lfc-api peerId'
  }
}