CsMepDSfHDJVd2ckHVov9F44zpR2Efjkf4bikPWTxMzxQCA
12VpEWKJVwxRiDd8qjNAyEijS3CuhBDhiYnhLJc7ANfqmVJM
3GiJTNPqLk4poWemY8zhCpNpmiPnK5ncSS
| const Protomux = require('protomux') | |
| const SecretStream = require('@hyperswarm/secret-stream') | |
| const c = require('compact-encoding') | |
| const duplexify = require('duplexify') | |
| const stream = require('stream') | |
| const opts = { protocol: 'foo'} |
| const hypercore = require('hypercore') | |
| const RAM = require('random-access-memory') | |
| const hyperswarm = require('hyperswarm') | |
| // const HypercoreProtocol = require('hypercore-protocol') | |
| const createTestnet = require('@hyperswarm/testnet') | |
| start() | |
| async function start () { | |
| const { bootstrap } = await createTestnet(3) |
| const hypercore = require('hypercore') | |
| const RAM = require('random-access-memory') | |
| const hyperswarm = require('hyperswarm') | |
| const createTestnet = require('@hyperswarm/testnet') | |
| // const bootstrap = require('./bootstrappers.js') | |
| start() | |
| async function start () { | |
| const { bootstrap } = await createTestnet(3) |
| const DHT = require('@hyperswarm/dht') | |
| module.exports = bootstrappers | |
| async function bootstrappers ({ amount = 1, log = console.log.bind(console) } = {}) { | |
| if ((!Number.isInteger(amount)) || amount < 2) amount = 1 | |
| const node0 = await make_node({ port: 10000, ephemeral: false, bootstrap: [] }) | |
| const info0 = info(node0) |
| const DHT = require('@hyperswarm/dht') | |
| const bootstrapper1 = new DHT({ ephemeral: true }) | |
| await bootstrapper1.bind(10001) | |
| const bootstrapper2 = new DHT({ | |
| bootstrap: [ | |
| { host: bootstrapper1.address().address, port: bootstrapper1.address().port }, | |
| ], | |
| ephemeral: false |
| const hypercore = require('hypercore') | |
| const RAM = require('random-access-memory') | |
| const hyperswarm = require('hyperswarm') | |
| const multiplex = require('multiplex') | |
| const Protocol = require('hypercore-protocol') | |
| var counter = 10 | |
| const bootstrap_nodes = [ | |
| { host: '0.0.0.0', port: 10001 }, | |
| { host: '0.0.0.0', port: 10002 }, |
| const hypercore = require('hypercore') | |
| // const RAM = require('random-access-memory') | |
| // const RAM = require('random-access-memory') | |
| const hyperswarm = require('hyperswarm') | |
| const multiplex = require('multiplex') | |
| const Protocol = require('hypercore-protocol') | |
| const DHT = require('@hyperswarm/dht') | |
| /*-------------------------------------- | |
| PEER 1 | |
| ---------------------------------------- */ | |
| const DHT = require('@hyperswarm/dht') | |
| start() | |
| async function start () { |
| const hypercore = require('hypercore') | |
| const hyperswarm = require('hyperswarm') | |
| const RAM = require('random-access-memory') | |
| make_feed() | |
| async function make_feed () { | |
| const feed = new hypercore(RAM, { valueEncoding: 'utf-8' }) | |
| await ready(feed) |