-
Notifications
You must be signed in to change notification settings - Fork 1
Description
you can't imagine how painful it is to ask for help. i'm supposed to be a jedi. unfortunately the stupid light saber broke in the middle of my livestream as i am tooting my own horn. it was mad embarrassing.
so i can no longer connect to the default dht servers like out of the blue. i even ran some of your example code modified slightly and instead of the two (1 local behind firewall router switch etc, one cloud facing internet) passing hello messages, i get this :
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
fully joined...
network capabilities {
bound: true,
boostrapped: false,
bootstrapped: false,
holepunched: false
} Error: All bootstrap nodes failed
at /home/spayse/swarmtest/node_modules/@dwebswarm/discovery/index.js:245:36
at Object.callback (/home/spayse/swarmtest/node_modules/dht-rpc/index.js:199:23)
at IO._finish (/home/spayse/swarmtest/node_modules/dht-rpc/lib/io.js:158:9)
at IO._cancel (/home/spayse/swarmtest/node_modules/dht-rpc/lib/io.js:207:10)
at IO._ontick (/home/spayse/swarmtest/node_modules/dht-rpc/lib/io.js:231:12)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
All bootstrap nodes failed
its breaking my heart because i am very close to launching decentralized p2p social media blockchain
here is the code
'use strict'
const { inspect } = require('util')
let ma,mb=" "
const dwebswarm1 = require('dwebswarm')
const dwebswarm = require('dwebswarm')
const crypto = require('crypto')
const myName= "Bubba"
let mySock
let sockets
const id=crypto.createHash('sha256')
.update(myName)
.digest()
const swarm1 = dwebswarm({
id:Buffer.from(id),
announceLocalAddress: true,
keepExistingConnections: true,
maxPeers: 120,
ephemeral:true,
requeue: 5000,
lookup: true,
announce: true
})
const swarm2 = dwebswarm1({
id:Buffer.from(id),
announceLocalAddress: true,
keepExistingConnections: true,
maxPeers: 120,
ephemeral:false,
requeue: 5000,
lookup: true,
announce: true
})
function writer(msg){
if (sockets)
sockets.forEach(socket=>{
socket.write(Buffer.from(msg))
})
}
const topica=Buffer.from("BubbleDapp")
//if (!process.argv[2]) { throw Error('node example.js ') }
const bubmain = crypto.createHash('sha256')
.update(topica)
.digest()
function connectSwarm(swarm,key){
swarm.connectivity((err, capabilities) => {
console.log('network capabilities', capabilities, err || '')
})
swarm.setMaxListeners(300)
swarm.join(key, {
announce: true,
lookup: true
}, function () {
console.log('fully joined...')
})
swarm.on('connection', function (socket, info) {
mySock=socket
domsg()
sockets=[]
const {
priority,
status,
retries,
peer,
client
} = info
console.log('new connection!', priority: ${priority} status: ${status} retries: ${retries} client: ${client} peer: ${!peer ? peer :
${inspect(peer, { indentationLvl: 4 }).slice(2, -2)}
} )
if (client) process.stdin.pipe(socket)
else socket.pipe(process.stdout)
socket.on("data",data=>{
console.log(data.toString())
// ma = data.toString()
})
sockets.push(mySock)
})
}
function domsg(){
let k = "hi"+myName
setTimeout(() => {
writer(k)
}, 5555);
let y = "this msg is new "+myName
setTimeout(() => {
writer(y)
writer(y)
}, 17000);
}
connectSwarm(swarm1,bubmain)
connectSwarm(swarm2,id)
if (mb!==ma){writer(ma)}
i can see how to setup the dht and make some sort of private swarm or something but that gives me a centralized server for my enemies/rivals to exploit