Skip to content

Instantly share code, notes, and snippets.

@dominictarr
Last active July 22, 2024 00:14
Show Gist options
  • Save dominictarr/37abe288664b6b0d3b4f349637db820f to your computer and use it in GitHub Desktop.
Save dominictarr/37abe288664b6b0d3b4f349637db820f to your computer and use it in GitHub Desktop.
{ '@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519': 'wx.larpa.net:8008:@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519',
'@D0GsAaMyt96Ze3q1YiiuzWhPkyou2fVTUgw8Xr+G7Jo=.ed25519': '9ithub.com:8008:@D0GsAaMyt96Ze3q1YiiuzWhPkyou2fVTUgw8Xr+G7Jo=.ed25519',
'@dBQlwh9Gtr3i5YMOGtIOKtGNVepeu+nyb6KGl1vtOcM=.ed25519': 'sp9.solarpunk.dk:8008:@dBQlwh9Gtr3i5YMOGtIOKtGNVepeu+nyb6KGl1vtOcM=.ed25519',
'@SP4xNZmDsOuRrjDS6NCcmr3xoieXQOMPBQ4TkUHSJ2M=.ed25519': 'sp4.solarpunk.dk:8008:@SP4xNZmDsOuRrjDS6NCcmr3xoieXQOMPBQ4TkUHSJ2M=.ed25519',
'@BzMp3eRNjPUonwRd/0loT3KaRKIMFx7ZOZQE1F+XDug=.ed25519': 'sbot.ktorn.com:8008:@BzMp3eRNjPUonwRd/0loT3KaRKIMFx7ZOZQE1F+XDug=.ed25519',
'@eM4e8pmRiZpeCBitqp6vq3lT8EwC5UjjKuajHbpWnNI=.ed25519': '198.199.97.80:8008:@eM4e8pmRiZpeCBitqp6vq3lT8EwC5UjjKuajHbpWnNI=.ed25519',
'@YXquIbh1OqCCdMuqCO4tSJuYR7RL811CTuu59n7G0pk=.ed25519': 'post.tableflip.io:8008:@YXquIbh1OqCCdMuqCO4tSJuYR7RL811CTuu59n7G0pk=.ed25519',
'@nSCVHJ5OSajcynWgo3Xh0bChZN3e4oV1ooIuFWdxrmg=.ed25519': 'hub.devcontrol.org:8008:@nSCVHJ5OSajcynWgo3Xh0bChZN3e4oV1ooIuFWdxrmg=.ed25519',
'@SP3xGpWJJjhdX78uZiT/hKwTShtSAt4VFZ7OQm9ggzI=.ed25519': 'sp3.solarpunk.dk:8008:@SP3xGpWJJjhdX78uZiT/hKwTShtSAt4VFZ7OQm9ggzI=.ed25519',
'@TRE4lNNXrtx3KK9Tgks2so2PjCP6w9tRvsy7wyqiyo4=.ed25519': 'ssb.alarum.de:8008:@TRE4lNNXrtx3KK9Tgks2so2PjCP6w9tRvsy7wyqiyo4=.ed25519',
'@RhVQvz/j2LnC/VoWRL4DZJq+NsFDsqMY/VNIlxRWEcI=.ed25519': 'ssb.participant.io:8008:@RhVQvz/j2LnC/VoWRL4DZJq+NsFDsqMY/VNIlxRWEcI=.ed25519',
'@SOJaamc8LB5js+OKLM40J76YUgxUfLhlR7CxGeLluC8=.ed25519': 'fc44:a875:6a78:0001:335e:b2b6:2873:c4cc:8008:@SOJaamc8LB5js+OKLM40J76YUgxUfLhlR7CxGeLluC8=.ed25519',
'@iOyfRmje5LFAErH7M3faTLNMQUTXCnjECbLtniVJ478=.ed25519': 'h.ssb.gathman.org:8008:@iOyfRmje5LFAErH7M3faTLNMQUTXCnjECbLtniVJ478=.ed25519',
'@FJDMuATvh0a3qIcIPcstUANVIj362fWkYCG5bnkZ5nA=.ed25519': 'ssb.ekata.social:8008:@FJDMuATvh0a3qIcIPcstUANVIj362fWkYCG5bnkZ5nA=.ed25519',
'@d64Q93XzBhbr2JCLWkZgvzKwTHMvwFgRdtw4fHFlF5k=.ed25519': 'ssb.mikey.nz:8008:@d64Q93XzBhbr2JCLWkZgvzKwTHMvwFgRdtw4fHFlF5k=.ed25519',
'@So2yhYGA2ZOwRh2043whISASD+55PL1P9+peIy/qbj8=.ed25519': 'pub.heropunch.io:8008:@So2yhYGA2ZOwRh2043whISASD+55PL1P9+peIy/qbj8=.ed25519',
'@wmnteCWhbQoOSeBRUERdzvMMdFjBXVL43wLcWwQbzMg=.ed25519': 'hulk.ccom.uprrp.edu:8008:@wmnteCWhbQoOSeBRUERdzvMMdFjBXVL43wLcWwQbzMg=.ed25519',
'@WndnBREUvtFVF14XYEq01icpt91753bA+nVycEJIAX4=.ed25519': 'pub.t4l3.net:8008:@WndnBREUvtFVF14XYEq01icpt91753bA+nVycEJIAX4=.ed25519',
'@A0fQyUSupOzez2cXEex84TsF8b7/uB/6rVvr6FoqagQ=.ed25519': 'pub.el7orreyyah.com:8008:@A0fQyUSupOzez2cXEex84TsF8b7/uB/6rVvr6FoqagQ=.ed25519',
'@ItVrWJk1lAuGIAsQ7vP8R6Nrp7ZkkZ030KVdHY/B7Dg=.ed25519': 'pub.sito.org:8008:@ItVrWJk1lAuGIAsQ7vP8R6Nrp7ZkkZ030KVdHY/B7Dg=.ed25519',
'@7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=.ed25519': '128.199.76.241:8008:@7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=.ed25519',
'@MflVZCcOBOUe6BLrm/8TyirkTu9/JtdnIJALcd8v5bc=.ed25519': '138.68.27.255:8008:@MflVZCcOBOUe6BLrm/8TyirkTu9/JtdnIJALcd8v5bc=.ed25519',
'@wXIn0d7W57npReOBRuapAPGE1FIhOvtdJaA5clSH2v0=.ed25519': 'ssb.microcultu.re:8008:@wXIn0d7W57npReOBRuapAPGE1FIhOvtdJaA5clSH2v0=.ed25519'
}
var pull = require('pull-stream')
var paramap = require('pull-paramap')
var createClient = require('ssb-client')
function toAddress (peer) {
return [peer.host, peer.port, peer.key].join(':')
}
createClient(function (err, sbot) {
if(err) throw err
var found = {}, c = 0
sbot.gossip.peers(function (err, peers) {
if(err) throw err
console.log(peers.length)
pull(
pull.values(peers),
paramap(function (peer, cb) {
console.error('attempt', toAddress(peer))
createClient(null, {key:peer.key, host: peer.host, port: peer.port, timeout: 1000}, function (err, sbot) {
if(err) {
console.error('-', toAddress(peer))
cb()
}
else {
console.error('+', c++, toAddress(peer))
sbot.close(true, function () {
found[sbot.id] = toAddress(peer)
cb(null, sbot.id)
})
}
})
}),
pull.filter(),
pull.drain(console.log, function () {
console.log(found)
sbot.close(true)
})
)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment