segundo commit
This commit is contained in:
parent
6b8b75863a
commit
d2e79d63a5
13601 changed files with 1117197 additions and 0 deletions
266
node_modules/ssb-server/test/bin.js
generated
vendored
Normal file
266
node_modules/ssb-server/test/bin.js
generated
vendored
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
var fs = require('fs')
|
||||
var test = require('tape')
|
||||
var spawn = require('child_process').spawn
|
||||
var exec = require('child_process').exec
|
||||
var crypto = require('crypto')
|
||||
var net = require('net')
|
||||
var mkdirp = require('mkdirp')
|
||||
var join = require('path').join
|
||||
var ma = require('multiserver-address')
|
||||
|
||||
// travis currently does not support ipv6, becaue GCE does not.
|
||||
var has_ipv6 = process.env.TRAVIS === undefined
|
||||
var children = []
|
||||
|
||||
process.on('exit', function () {
|
||||
children.forEach(function (e) {
|
||||
e.kill('SIGKILL')
|
||||
})
|
||||
})
|
||||
process.on('SIGINT', function () {
|
||||
children.forEach(function (e) {
|
||||
e.kill('SIGKILL')
|
||||
})
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
var exited = false
|
||||
var count = 0
|
||||
function ssbServer(t, argv, opts) {
|
||||
count ++
|
||||
exited = false
|
||||
opts = opts || {}
|
||||
|
||||
var sh = spawn(
|
||||
process.execPath,
|
||||
[join(__dirname, '../bin.js')]
|
||||
.concat(argv),
|
||||
Object.assign({
|
||||
env: Object.assign({}, process.env, {ssb_appname: 'test'}),
|
||||
}, opts)
|
||||
)
|
||||
|
||||
sh.once('exit', function (code, name) {
|
||||
exited = true
|
||||
t.equal(name,'SIGKILL')
|
||||
if(--count) return
|
||||
t.end()
|
||||
})
|
||||
|
||||
sh.stdout.pipe(process.stdout)
|
||||
sh.stderr.pipe(process.stderr)
|
||||
|
||||
children.push(sh)
|
||||
|
||||
return function end () {
|
||||
while(children.length) children.shift().kill('SIGKILL')
|
||||
}
|
||||
}
|
||||
|
||||
function try_often(times, opts, work, done) {
|
||||
if (typeof opts == 'function') {
|
||||
done = work
|
||||
work = opts
|
||||
opts = {}
|
||||
}
|
||||
const delay = 2000
|
||||
setTimeout(function() { // delay first try
|
||||
console.log('try more:', times)
|
||||
work(function(err, result) {
|
||||
if (!err) return done(null, result)
|
||||
if (opts.ignore && err.message && !err.message.match(opts.ignore)) {
|
||||
console.error('Fatal error:', err)
|
||||
return done(err)
|
||||
}
|
||||
if (!times) return done(err)
|
||||
if(exited) return done(new Error('already exited'))
|
||||
console.warn('retry run', times)
|
||||
console.error('work(err):', err)
|
||||
try_often(times-1, work, done)
|
||||
})
|
||||
}, delay)
|
||||
}
|
||||
|
||||
function connect(port, host, cb) {
|
||||
var done = false
|
||||
var socket = net.connect(port, host)
|
||||
socket.on('error', function(err) {
|
||||
if (done) return
|
||||
done = true
|
||||
cb(err)
|
||||
})
|
||||
socket.on('connect', function() {
|
||||
if (done) return
|
||||
done = true
|
||||
cb(null)
|
||||
})
|
||||
}
|
||||
|
||||
function testSsbServer(t, opts, asConfig, port, cb) {
|
||||
var dir = '/tmp/ssb-server_binjstest_' + Date.now()
|
||||
if('function' === typeof port)
|
||||
cb = port, port = opts.port
|
||||
mkdirp.sync(dir)
|
||||
var args = [
|
||||
'start',
|
||||
'--path '+dir
|
||||
]
|
||||
|
||||
if(asConfig) {
|
||||
fs.writeFileSync(join(dir, '.testrc'), JSON.stringify(opts))
|
||||
} else {
|
||||
;(function toArgs (prefix, opts) {
|
||||
for(var k in opts) {
|
||||
if(opts[k] && 'object' == typeof opts[k])
|
||||
toArgs(prefix+k+'.', opts[k])
|
||||
else
|
||||
args.push(prefix+k+'='+opts[k])
|
||||
}
|
||||
})('--', opts)
|
||||
}
|
||||
|
||||
var end = ssbServer(t, args, {
|
||||
cwd: dir
|
||||
})
|
||||
|
||||
try_often(10, {
|
||||
ignore: /ECONNREFUSED/
|
||||
}, function work(cb) {
|
||||
connect(port, opts.host, cb)
|
||||
}, function (err) {
|
||||
cb(err)
|
||||
end()
|
||||
})
|
||||
}
|
||||
|
||||
var c = 0
|
||||
;['::1', '::', '127.0.0.1', 'localhost'].forEach(function (host) {
|
||||
if(!has_ipv6 && /:/.test(host)) return
|
||||
|
||||
;[9002, 9001].forEach(function (port) {
|
||||
;[true, false].forEach(function (asConfig) {
|
||||
var opts = {
|
||||
host: host,
|
||||
port: 9001,
|
||||
ws: { port: 9002 }
|
||||
}
|
||||
// if(c++) return
|
||||
test('run bin.js server with ' +
|
||||
(asConfig ? 'a config file' : 'command line options') +
|
||||
':'+JSON.stringify(opts)+' then connect to port:'+port
|
||||
, function(t) {
|
||||
testSsbServer(t, opts, true, function (err) {
|
||||
t.error(err, 'Successfully connect eventually')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('ssbServer should have websockets and http server by default', function(t) {
|
||||
var path = '/tmp/ssbServer_binjstest_' + Date.now()
|
||||
var caps = crypto.randomBytes(32).toString('base64')
|
||||
var end = ssbServer(t, [
|
||||
'start',
|
||||
'--host=127.0.0.1',
|
||||
'--port=9001',
|
||||
'--ws.port=9002',
|
||||
'--path', path,
|
||||
'--caps.shs', caps
|
||||
])
|
||||
|
||||
try_often(10, function work(cb) {
|
||||
exec([
|
||||
join(__dirname, '../bin.js'),
|
||||
'getAddress',
|
||||
'device',
|
||||
'--',
|
||||
'--host=127.0.0.1',
|
||||
'--port=9001',
|
||||
'--path', path,
|
||||
'--caps.shs', caps
|
||||
].join(' '), {
|
||||
env: Object.assign({}, process.env, {ssb_appname: 'test'})
|
||||
}, function(err, stdout, sderr) {
|
||||
if (err) return cb(err)
|
||||
cb(null, JSON.parse(stdout)) // remove quotes
|
||||
})
|
||||
}, function(err, addr) {
|
||||
t.error(err, 'ssbServer getAdress succeeds eventually')
|
||||
if (err) return end()
|
||||
t.ok(addr, 'address is not null')
|
||||
t.comment('result of ssb-server getAddress: ' + addr)
|
||||
|
||||
var remotes = ma.decode(addr)
|
||||
console.log('remotes', remotes, addr)
|
||||
ws_remotes = remotes.filter(function(a) {
|
||||
return a.find(function(component) {
|
||||
return component.name == 'ws'
|
||||
})
|
||||
})
|
||||
t.equal(ws_remotes.length, 1, 'has one ws remote')
|
||||
var remote = ma.encode([ws_remotes[0]])
|
||||
// this breaks if multiserver address encoding changes
|
||||
t.ok(remote.indexOf('9002') > 0, 'ws address contains expected port')
|
||||
|
||||
// this is a bit annoying. we can't signal ssb-client to load the secret from .path
|
||||
// it either has to be the first argument, already loaded
|
||||
var key = require('ssb-keys').loadOrCreateSync(join(path, 'secret'))
|
||||
require('ssb-client')(key, {
|
||||
path: path,
|
||||
caps: { shs: caps }, // has to be set when setting any config
|
||||
remote: remote
|
||||
}, function(err, ssb) {
|
||||
t.error(err, 'ssb-client returns no error')
|
||||
t.ok(ssb.manifest, 'got manifest from api')
|
||||
t.ok(ssb.version, 'got version from api')
|
||||
ssb.whoami(function(err, feed) {
|
||||
t.error(err, 'ssb.whoami succeeds')
|
||||
t.equal(feed.id[0], '@', 'feed.id has @ sigil')
|
||||
end()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('ssb-server client should work without options', function(t) {
|
||||
var path = '/tmp/ssb-server_binjstest_' + Date.now()
|
||||
mkdirp.sync(path)
|
||||
fs.writeFileSync(path+'/config',
|
||||
JSON.stringify({
|
||||
port: 43293, ws: { port: 43294 }
|
||||
})
|
||||
)
|
||||
var caps = crypto.randomBytes(32).toString('base64')
|
||||
var end = ssbServer(t, [
|
||||
'start',
|
||||
'--path', path,
|
||||
'--config', path+'/config',
|
||||
'--caps.shs', caps
|
||||
])
|
||||
|
||||
try_often(10, function work(cb) {
|
||||
exec([
|
||||
join(__dirname, '../bin.js'),
|
||||
'getAddress',
|
||||
'device',
|
||||
'--path', path,
|
||||
'--config', path+'/config',
|
||||
'--caps.shs', caps
|
||||
].join(' '), {
|
||||
env: Object.assign({}, process.env, {ssb_appname: 'test'})
|
||||
}, function(err, stdout, sderr) {
|
||||
if (err) return cb(err)
|
||||
cb(null, JSON.parse(stdout)) // remove quotes
|
||||
})
|
||||
}, function(err, addr) {
|
||||
t.error(err, 'ssb-server getAddress succeeds eventually')
|
||||
if (err) return end()
|
||||
t.ok(addr)
|
||||
|
||||
t.comment('result of ssb-server getAddress: ' + addr)
|
||||
end()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
117
node_modules/ssb-server/test/caps.js
generated
vendored
Normal file
117
node_modules/ssb-server/test/caps.js
generated
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
|
||||
var cont = require('cont')
|
||||
var deepEqual = require('deep-equal')
|
||||
var tape = require('tape')
|
||||
var pull = require('pull-stream')
|
||||
var ssbKeys = require('ssb-keys')
|
||||
|
||||
var u = require('./util')
|
||||
|
||||
// create 3 servers
|
||||
// give them all pub servers (on localhost)
|
||||
// and get them to follow each other...
|
||||
|
||||
var createSsbServer =
|
||||
require('secret-stack')(require('./defaults'))
|
||||
.use(require('ssb-db'))
|
||||
.use(require('ssb-replicate'))
|
||||
.use(require('ssb-friends'))
|
||||
.use(require('ssb-gossip'))
|
||||
.use(require('ssb-logging'))
|
||||
|
||||
var createHash = require('crypto').createHash
|
||||
|
||||
function hash (data) {
|
||||
return createHash('sha256').update(data, 'utf8').digest()
|
||||
}
|
||||
|
||||
var sign_cap1 = hash('test-sign-cap1')
|
||||
var shs_cap1 = hash('test-shs-cap1')
|
||||
|
||||
var alice, bob, carol
|
||||
var dbA = createSsbServer({
|
||||
temp: 'server-alice',
|
||||
port: 45451, timeout: 1400,
|
||||
keys: alice = ssbKeys.generate(),
|
||||
caps: {
|
||||
shs: shs_cap1,
|
||||
sign: sign_cap1
|
||||
},
|
||||
level: 'info'
|
||||
})
|
||||
|
||||
//uses default caps, incompatible with above
|
||||
var dbB = createSsbServer({
|
||||
temp: 'server-bob',
|
||||
port: 45452, timeout: 1400,
|
||||
keys: bob = ssbKeys.generate(),
|
||||
seeds: [dbA.getAddress()],
|
||||
level: 'info'
|
||||
})
|
||||
|
||||
//can connect to A
|
||||
var dbC = createSsbServer({
|
||||
temp: 'server-carol',
|
||||
port: 45453, timeout: 1400,
|
||||
keys: alice = ssbKeys.generate(),
|
||||
caps: {
|
||||
shs: shs_cap1,
|
||||
sign: sign_cap1
|
||||
},
|
||||
level: 'info'
|
||||
})
|
||||
|
||||
|
||||
tape('signatures not accepted if made from different caps', function (t) {
|
||||
|
||||
|
||||
dbA.publish({type: 'test', foo: true}, function (err, msg) {
|
||||
if(err) throw err
|
||||
console.log(msg)
|
||||
dbB.add(msg.value, function (err) {
|
||||
t.ok(err) //should not be valid in this universe
|
||||
t.ok(/invalid/.test(err.message))
|
||||
console.log(err.stack)
|
||||
t.end()
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
tape('cannot connect if different shs caps, custom -> default', function (t) {
|
||||
dbA.connect(dbB.getAddress(), function (err) {
|
||||
t.ok(err)
|
||||
console.log(err.stack)
|
||||
|
||||
t.end()
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
tape('cannot connect if different shs caps, default -> custom', function (t) {
|
||||
dbB.connect(dbA.getAddress(), function (err) {
|
||||
t.ok(err)
|
||||
|
||||
console.log(err.stack)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
tape('cannot connect if different shs caps, default -> custom', function (t) {
|
||||
dbC.connect(dbA.getAddress(), function (err) {
|
||||
if(err) throw err
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
tape('cleanup', function (t) {
|
||||
dbA.close()
|
||||
dbB.close()
|
||||
dbC.close()
|
||||
t.end()
|
||||
})
|
||||
|
||||
|
||||
|
||||
577
node_modules/ssb-server/test/data/gossip.json
generated
vendored
Normal file
577
node_modules/ssb-server/test/data/gossip.json
generated
vendored
Normal file
|
|
@ -0,0 +1,577 @@
|
|||
{
|
||||
"ts": 1458983392551,
|
||||
"peers":[
|
||||
{
|
||||
"host": "188.166.252.233",
|
||||
"port": 8008,
|
||||
"key": "@uRECWB4KIeKoNMis2UYWyB2aQPvWmS3OePQvBj2zClg=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 73,
|
||||
"duration": {
|
||||
"mean": 31904.760869565216,
|
||||
"count": 46,
|
||||
"stdev": 4283.4027066299295
|
||||
},
|
||||
"client": true,
|
||||
"time": {
|
||||
"connect": 1458983141389,
|
||||
"hangup": 1458983172624,
|
||||
"attempt": 1458983106552
|
||||
},
|
||||
"stateChange": 1458983172624,
|
||||
"ping": {
|
||||
"rtt": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"skew": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "176.58.117.63",
|
||||
"port": 8008,
|
||||
"key": "@J+0DGLgRn8H5tVLCcRUfN7NfUcTGEZKqML3krEOJjDY=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 61,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 1,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458953075788,
|
||||
"hangup": 1458953080790
|
||||
},
|
||||
"stateChange": 1458953080790,
|
||||
"active": false,
|
||||
"failure": 1
|
||||
},
|
||||
{
|
||||
"host": "88.198.115.222",
|
||||
"port": 8008,
|
||||
"key": "@im4Qn0fCzpD3YfsegHFLJzkNXYUb/nYnlfuCf+LmPuM=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 20,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 4,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458953251559,
|
||||
"hangup": 1458953251864
|
||||
},
|
||||
"stateChange": 1458953251864,
|
||||
"active": false,
|
||||
"failure": 4
|
||||
},
|
||||
{
|
||||
"port": 8008,
|
||||
"key": "@J+0DGLgRn8H5tVLCcRUfN7NfUcTGEZKqML3krEOJjDY=.ed25519",
|
||||
"host": "localhost",
|
||||
"source": "pub",
|
||||
"announcers": 2,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 1,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458953201000,
|
||||
"hangup": 1458953201006
|
||||
},
|
||||
"stateChange": 1458953201006,
|
||||
"active": false,
|
||||
"failure": 1
|
||||
},
|
||||
{
|
||||
"host": "131.72.139.47",
|
||||
"port": 8008,
|
||||
"key": "@V+sfZ+X/MSUb+cO3GVI4gn1cCVVwz1+t6B+J9DlUkQs=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 36,
|
||||
"duration": {
|
||||
"mean": 32998.13636363636,
|
||||
"count": 22,
|
||||
"stdev": 5928.972188219304
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458983355392,
|
||||
"connect": 1458983356298,
|
||||
"hangup": 1458983280114
|
||||
},
|
||||
"stateChange": 1458983356298,
|
||||
"state": "connected",
|
||||
"client": true,
|
||||
"ping": {
|
||||
"rtt": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"skew": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "24.75.24.253",
|
||||
"port": 8008,
|
||||
"key": "@JMnMSsDHjwZfUlC2J8ZiIAOoxM5KJfsvewmVe39/wSM=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 7,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 1,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458953190929,
|
||||
"hangup": 1458953195931
|
||||
},
|
||||
"stateChange": 1458953195931,
|
||||
"active": false,
|
||||
"failure": 1
|
||||
},
|
||||
{
|
||||
"host": "45.33.29.124",
|
||||
"port": 8008,
|
||||
"key": "@0GLMsG6IgXdv+GjG0U5UnZlwxHnomlfmrlWugx8i4dg=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 28,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 2,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458957207322,
|
||||
"hangup": 1458957208010
|
||||
},
|
||||
"stateChange": 1458957208010,
|
||||
"active": false,
|
||||
"failure": 2
|
||||
},
|
||||
{
|
||||
"host": "74.207.246.247",
|
||||
"port": 8008,
|
||||
"key": "@omgyp7Pnrw+Qm0I6T6Fh5VvnKmodMXwnxTIesW2DgMg=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 9,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 3,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458971210200,
|
||||
"hangup": 1458971215201
|
||||
},
|
||||
"stateChange": 1458971215201,
|
||||
"active": false,
|
||||
"failure": 3
|
||||
},
|
||||
{
|
||||
"host": "188.166.107.197",
|
||||
"port": 8008,
|
||||
"key": "@/RM1Id8j05uitIt6iwMpiivnCqHcbcC1IHyi5FrvLLQ=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 7,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 1,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458971090648,
|
||||
"hangup": 1458971090943
|
||||
},
|
||||
"stateChange": 1458971090943,
|
||||
"active": false,
|
||||
"failure": 1
|
||||
},
|
||||
{
|
||||
"host": "24.75.24.253",
|
||||
"port": 8008,
|
||||
"key": "@WzvzUh2KMhAfWeJEpkI01BGlTtLXOei7GoB/dLVjcjE=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 3,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 2,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458953330661,
|
||||
"hangup": 1458953335663
|
||||
},
|
||||
"stateChange": 1458953335663,
|
||||
"active": false,
|
||||
"failure": 2
|
||||
},
|
||||
{
|
||||
"host": "9ithub.com",
|
||||
"port": 8008,
|
||||
"key": "@GLH9VPzvvU2KcnnUu2n5oxOqaTUtzw+Rk6fd/Kb9Si0=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 3,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 2,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458971894621,
|
||||
"hangup": 1458971899623
|
||||
},
|
||||
"stateChange": 1458971899623,
|
||||
"active": false,
|
||||
"failure": 2
|
||||
},
|
||||
{
|
||||
"host": "9ithub.com",
|
||||
"port": 8008,
|
||||
"key": "@D0GsAaMyt96Ze3q1YiiuzWhPkyou2fVTUgw8Xr+G7Jo=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 6,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 1,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458961886104,
|
||||
"hangup": 1458961891107
|
||||
},
|
||||
"stateChange": 1458961891107,
|
||||
"active": false,
|
||||
"failure": 1
|
||||
},
|
||||
{
|
||||
"host": "104.236.72.67",
|
||||
"port": 8008,
|
||||
"key": "@xBZ783+eCc9+vc/CHxR03y1nAcfULJUAOgd3zWsy1uY=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 6,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 4,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458953376539,
|
||||
"hangup": 1458953376759
|
||||
},
|
||||
"stateChange": 1458953376759,
|
||||
"active": false,
|
||||
"failure": 4
|
||||
},
|
||||
{
|
||||
"host": "newpi.ffhh",
|
||||
"port": 8080,
|
||||
"key": "@gYCJpN4eGDjHFnWW2Fcusj8O4QYbVDUW6rNYh7nNEnc=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 2,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 1,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458950587731,
|
||||
"hangup": 1458950588413
|
||||
},
|
||||
"stateChange": 1458950588413,
|
||||
"active": false,
|
||||
"failure": 1
|
||||
},
|
||||
{
|
||||
"host": "acab.mobi",
|
||||
"port": 5228,
|
||||
"key": "@Ia0xWQGJSTjRfYjHDDAFizXR9e8l5RQctTqYcbtR+Es=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 9,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 2,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458961704834,
|
||||
"hangup": 1458961705136
|
||||
},
|
||||
"stateChange": 1458961705136,
|
||||
"active": false,
|
||||
"failure": 2
|
||||
},
|
||||
{
|
||||
"host": "pi.bret.io",
|
||||
"port": 8008,
|
||||
"key": "@j3qWwQrWPzTM9zNgk0SI0FcqP1ULGquuINYEWfL330g=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 50,
|
||||
"duration": {
|
||||
"mean": 32263.5625,
|
||||
"count": 32,
|
||||
"stdev": 1058.4539709376832
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458983320400,
|
||||
"connect": 1458983321181,
|
||||
"hangup": 1458983352907
|
||||
},
|
||||
"stateChange": 1458983352907,
|
||||
"client": true,
|
||||
"ping": {
|
||||
"rtt": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"skew": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "drinkbot.org",
|
||||
"port": 8008,
|
||||
"key": "@kOK9sfSLeFrQMtYaqLQ3nZE19v2IDiEwlpEdAqep3bw=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 22,
|
||||
"duration": {
|
||||
"mean": 31111.65,
|
||||
"count": 20,
|
||||
"stdev": 278.72231252617365
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458983212281,
|
||||
"connect": 1458983212774,
|
||||
"hangup": 1458983243562
|
||||
},
|
||||
"stateChange": 1458983243562,
|
||||
"client": true,
|
||||
"ping": {
|
||||
"rtt": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"skew": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "128.199.132.182",
|
||||
"port": 8008,
|
||||
"key": "@DTNmX+4SjsgZ7xyDh5xxmNtFqa6pWi5Qtw7cE8aR9TQ=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 22,
|
||||
"duration": {
|
||||
"mean": 3632843.1666666665,
|
||||
"count": 18,
|
||||
"stdev": 1312601.5419976406
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458983143359,
|
||||
"connect": 1458983143915,
|
||||
"hangup": 1458982814101
|
||||
},
|
||||
"stateChange": 1458983143915,
|
||||
"state": "connected",
|
||||
"client": true,
|
||||
"ping": {
|
||||
"rtt": {
|
||||
"mean": 234,
|
||||
"count": 1,
|
||||
"stdev": 0
|
||||
},
|
||||
"skew": {
|
||||
"mean": -4,
|
||||
"count": 1,
|
||||
"stdev": 0
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "mindeco.de",
|
||||
"port": 110,
|
||||
"key": "@Uki1+Hds2kkx4rOWl202SPfcsgsdaLHJ/Y6OfPnK1xk=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 11,
|
||||
"duration": {
|
||||
"mean": 30915.4,
|
||||
"count": 25,
|
||||
"stdev": 4021.505538974173
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458982853190,
|
||||
"connect": 1458983037094,
|
||||
"hangup": 1458983068852
|
||||
},
|
||||
"stateChange": 1458983068852,
|
||||
"client": true,
|
||||
"ping": {
|
||||
"rtt": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"skew": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"fail": true
|
||||
},
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "pub.mixmix.io",
|
||||
"port": 8008,
|
||||
"key": "@uRECWB4KIeKoNMis2UYWyB2aQPvWmS3OePQvBj2zClg=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 35,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458983140788
|
||||
},
|
||||
"stateChange": 1458983140788,
|
||||
"state": "connected",
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "178.62.206.163",
|
||||
"port": 110,
|
||||
"key": "@Uki1+Hds2kkx4rOWl202SPfcsgsdaLHJ/Y6OfPnK1xk=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 23,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458983036198
|
||||
},
|
||||
"stateChange": 1458983036198,
|
||||
"state": "connected",
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "evbogue.com",
|
||||
"port": 8008,
|
||||
"key": "@9sCXwCJZJ9doPcx7oZ1gm7HNZapO2Z9iZ0FJHJdROio=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 9,
|
||||
"duration": {
|
||||
"mean": 37290.125,
|
||||
"count": 8,
|
||||
"stdev": 8451.830414731177
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458982816595,
|
||||
"connect": 1458982818525,
|
||||
"hangup": 1458982851463
|
||||
},
|
||||
"stateChange": 1458982851463,
|
||||
"client": true,
|
||||
"ping": {
|
||||
"rtt": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"skew": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"fail": true
|
||||
},
|
||||
"active": true,
|
||||
"failure": 0
|
||||
},
|
||||
{
|
||||
"host": "104.131.122.139",
|
||||
"port": 8008,
|
||||
"key": "@kZ9Ra80lKWlmzfjxh5PFAjJWYlCHEPxbqxNajdzhPF8=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 3,
|
||||
"duration": {
|
||||
"mean": 0,
|
||||
"count": 2,
|
||||
"stdev": 0
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458953214645,
|
||||
"hangup": 1458953214865
|
||||
},
|
||||
"stateChange": 1458953214865,
|
||||
"active": false,
|
||||
"failure": 2
|
||||
},
|
||||
{
|
||||
"host": "45.33.29.124",
|
||||
"port": 8008,
|
||||
"key": "@HogU/jcIAkSD/Owzjwv4X140CEW0FIco7QxPM47BVa8=.ed25519",
|
||||
"source": "pub",
|
||||
"announcers": 27,
|
||||
"duration": {
|
||||
"mean": 31529.136363636364,
|
||||
"count": 22,
|
||||
"stdev": 427.74847063697473
|
||||
},
|
||||
"time": {
|
||||
"attempt": 1458983282932,
|
||||
"connect": 1458983283615,
|
||||
"hangup": 1458983315097
|
||||
},
|
||||
"stateChange": 1458983315097,
|
||||
"client": true,
|
||||
"ping": {
|
||||
"rtt": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
},
|
||||
"skew": {
|
||||
"mean": 0,
|
||||
"count": 0,
|
||||
"stdev": null
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"failure": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
14
node_modules/ssb-server/test/defaults.js
generated
vendored
Normal file
14
node_modules/ssb-server/test/defaults.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//defaults only used in the tests!
|
||||
|
||||
var crypto = require('crypto')
|
||||
function hash(s) {
|
||||
return crypto.createHash('sha256').update(s, 'utf8').digest()
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
caps: {
|
||||
shs: hash('test default shs'),
|
||||
sign: hash('test default sign'),
|
||||
}
|
||||
}
|
||||
|
||||
16
node_modules/ssb-server/test/multiple-sbots.js
generated
vendored
Normal file
16
node_modules/ssb-server/test/multiple-sbots.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
var tape = require('tape')
|
||||
|
||||
tape('createSsbServer method allows creating multiple servers with the same plugins', function (t) {
|
||||
var createSsbServer = require('../').createSsbServer
|
||||
|
||||
var ssbServer1 = createSsbServer()
|
||||
.use(require('ssb-replicate'))
|
||||
|
||||
var ssbServer2 = createSsbServer()
|
||||
.use(require('ssb-replicate'))
|
||||
.use(require('ssb-gossip'))
|
||||
|
||||
t.pass()
|
||||
t.end()
|
||||
})
|
||||
|
||||
32
node_modules/ssb-server/test/util.js
generated
vendored
Normal file
32
node_modules/ssb-server/test/util.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
var ref = require('ssb-ref')
|
||||
|
||||
exports.follow = function (id) {
|
||||
return {
|
||||
type: 'contact', contact: id, following: true
|
||||
}
|
||||
}
|
||||
exports.unfollow = function (id) {
|
||||
return {
|
||||
type: 'contact', contact: id, following: false
|
||||
}
|
||||
}
|
||||
exports.block = function unfollow(id) {
|
||||
return {
|
||||
type: 'contact', contact: id, flagged: true
|
||||
}
|
||||
}
|
||||
|
||||
exports.pub = function (address) {
|
||||
return {
|
||||
type: 'pub',
|
||||
address: ref.parseAddress(address)
|
||||
}
|
||||
}
|
||||
|
||||
exports.file = function (hash) {
|
||||
return {
|
||||
type: 'file',
|
||||
file: hash
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue