blind-peer 2.7.7 → 2.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.js +12 -6
- package/package.json +2 -2
package/bin.js
CHANGED
|
@@ -8,6 +8,7 @@ const RegisterClient = require('autobase-discovery/client/register')
|
|
|
8
8
|
const safetyCatch = require('safety-catch')
|
|
9
9
|
const byteSize = require('tiny-byte-size')
|
|
10
10
|
const pino = require('pino')
|
|
11
|
+
const b4a = require('b4a')
|
|
11
12
|
|
|
12
13
|
const BlindPeer = require('.')
|
|
13
14
|
|
|
@@ -30,7 +31,8 @@ const cmd = command('blind-peer',
|
|
|
30
31
|
async function ({ flags }) {
|
|
31
32
|
const debug = flags.debug
|
|
32
33
|
const logger = pino({
|
|
33
|
-
level: debug ? 'debug' : 'info'
|
|
34
|
+
level: debug ? 'debug' : 'info',
|
|
35
|
+
name: 'blind-peer'
|
|
34
36
|
})
|
|
35
37
|
logger.info('Starting blind peer')
|
|
36
38
|
|
|
@@ -113,11 +115,10 @@ const cmd = command('blind-peer',
|
|
|
113
115
|
)
|
|
114
116
|
}
|
|
115
117
|
|
|
116
|
-
await blindPeer.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
await blindPeer.ready() // needed to be able to access the swarm object
|
|
119
|
+
blindPeer.swarm.on('ban', (peerInfo, err) => {
|
|
120
|
+
logger.warn(`Banned peer: ${b4a.toString(peerInfo.publicKey, 'hex')}.\n${err.stack}`)
|
|
121
|
+
})
|
|
121
122
|
if (debug) {
|
|
122
123
|
blindPeer.swarm.on('connection', (conn, peerInfo) => {
|
|
123
124
|
const key = idEnc.normalize(peerInfo.publicKey)
|
|
@@ -126,6 +127,11 @@ const cmd = command('blind-peer',
|
|
|
126
127
|
})
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
await blindPeer.listen()
|
|
131
|
+
|
|
132
|
+
logger.info(`Blind peer listening, local address is ${blindPeer.swarm.dht.localAddress().host}:${blindPeer.swarm.dht.localAddress().port}`)
|
|
133
|
+
logger.info(`Bytes allocated: ${byteSize(blindPeer.digest.bytesAllocated)} of ${byteSize(blindPeer.maxBytes)}`)
|
|
134
|
+
|
|
129
135
|
if (flags.autodiscoveryRpcKey) {
|
|
130
136
|
const autodiscoveryRpcKey = idEnc.decode(flags.autodiscoveryRpcKey)
|
|
131
137
|
const seed = idEnc.decode(flags.autodiscoverySeed)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blind-peer",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.9",
|
|
4
4
|
"description": "Blind peers help keep hypercores available",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"hypercore-id-encoding": "^1.3.0",
|
|
21
21
|
"hyperdb": "^4.9.4",
|
|
22
22
|
"hyperschema": "^1.10.3",
|
|
23
|
-
"hyperswarm": "^4.
|
|
23
|
+
"hyperswarm": "^4.13.0",
|
|
24
24
|
"paparam": "^1.8.0",
|
|
25
25
|
"pino": "^9.6.0",
|
|
26
26
|
"protomux-rpc": "^1.7.1",
|