Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dht-rpc

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dht-rpc - npm Package Compare versions

Comparing version 6.14.2 to 6.15.0

21

index.js

@@ -48,3 +48,11 @@ const { EventEmitter } = require('events')

this.online = true
this.stats = { queries: { active: 0, total: 0 } }
this.stats = {
queries: { active: 0, total: 0 },
commands: {
ping: this.io.stats.commands[PING],
pingNat: this.io.stats.commands[PING_NAT],
findNode: this.io.stats.commands[FIND_NODE],
downHint: this.io.stats.commands[DOWN_HINT]
}
}

@@ -62,3 +70,3 @@ this._nat = new NatSampler()

this._lastHost = null
this._shouldAddNode = opts.addNode || null
this._filterNode = opts.filterNode || opts.addNode || null // opts.addNode is deprecating, use opts.filterNode instead
this._onrow = (row) => row.on('full', (node) => this._onfullrow(node, row))

@@ -186,6 +194,11 @@ this._nonePersistentSamples = []

ready () {
async fullyBootstrapped () {
return this._bootstrapping
}
ready () {
// Deprecating, use fullyBootstrapped instead (removed on next major)
return this.fullyBootstrapped()
}
findNode (target, opts) {

@@ -323,3 +336,3 @@ if (this.destroyed) throw new Error('Node destroyed')

_addNodeFromNetwork (sample, from, to) {
if (this._shouldAddNode !== null && !this._shouldAddNode(from)) {
if (this._filterNode !== null && !this._filterNode(from)) {
return

@@ -326,0 +339,0 @@ }

@@ -31,2 +31,11 @@ const FIFO = require('fast-fifo')

this.stats = {
commands: [
{ tx: 0, rx: 0 }, // tx = transmitted, rx = received
{ tx: 0, rx: 0 },
{ tx: 0, rx: 0 },
{ tx: 0, rx: 0 }
]
}
this.onrequest = onrequest

@@ -92,2 +101,7 @@ this.onresponse = onresponse

this.congestion.recv()
if (req.command < this.stats.commands.length) {
this.stats.commands[req.command].rx++
}
this.onresponse(res, external)

@@ -261,2 +275,7 @@ req.onresponse(res, req)

if (session) session._attach(req)
if (command < this.stats.commands.length) {
this.stats.commands[command].tx++
}
return req

@@ -263,0 +282,0 @@ }

2

lib/query.js

@@ -257,3 +257,3 @@ const { Readable } = require('streamx')

node.id = peer.id(node.host, node.port)
if (this.dht._shouldAddNode !== null && !this.dht._shouldAddNode(node)) continue
if (this.dht._filterNode !== null && !this.dht._filterNode(node)) continue
if (b4a.equals(node.id, this.dht.table.id)) continue

@@ -260,0 +260,0 @@ // TODO: we could continue here instead of breaking to ensure that one of the nodes in the closer list

{
"name": "dht-rpc",
"version": "6.14.2",
"version": "6.15.0",
"description": "Make RPC calls over a Kademlia based DHT",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -140,3 +140,3 @@ # dht-rpc

#### `await node.ready()`
#### `await node.fullyBootstrapped()`

@@ -143,0 +143,0 @@ Wait for the node to be fully bootstrapped etc.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc