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

hyperswarm

Package Overview
Dependencies
Maintainers
4
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperswarm - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

brittle-test.js

9

index.js

@@ -32,9 +32,8 @@ const { EventEmitter } = require('events')

} = opts
this.keyPair = keyPair
const networkOpts = {}
if (opts.bootstrap) networkOpts.bootstrap = opts.bootstrap
this.dht = opts.dht || new DHT(networkOpts)
this.dht = opts.dht || new DHT({
bootstrap: opts.bootstrap,
debug: opts.debug
})
this.server = this.dht.createServer({

@@ -41,0 +40,0 @@ firewall: this._handleFirewall.bind(this)

{
"name": "hyperswarm",
"version": "3.0.3",
"version": "3.0.4",
"description": "A distributed networking stack for connecting peers",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -346,2 +346,47 @@ const { timeout } = require('nonsynchronous')

test('constructor options - debug options forwarded to DHT constructor', async (bootstrap, t) => {
const swarm1 = new Hyperswarm({
bootstrap,
backoffs: BACKOFFS,
jitter: 0,
debug: {
handshake: {
latency: [500, 500]
}
}
})
const swarm2 = new Hyperswarm({
bootstrap,
backoffs: BACKOFFS,
jitter: 0,
debug: {
handshake: {
latency: [500, 500]
}
}
})
const connected = new Promise(resolve => {
let connections = 0
const onconnect = () => {
if (++connections === 2) resolve()
}
swarm1.once('connection', onconnect)
swarm2.once('connection', onconnect)
})
const topic = Buffer.alloc(32).fill('hello world')
await swarm1.join(topic, { server: true }).flushed()
const start = Date.now()
swarm2.join(topic, { client: true })
await connected
const duration = Date.now() - start
t.true(duration > 500)
await destroyAll(swarm1, swarm2)
t.end()
})
function noop () {}
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