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 4.3.5 to 4.3.6

16

index.js

@@ -201,7 +201,2 @@ const { EventEmitter } = require('events')

const existing = this._allConnections.get(remotePublicKey)
if (existing) {
if (existing.isInitiator === true && isOpen(existing)) return true
}
const peerInfo = this.peers.get(b4a.toString(remotePublicKey, 'hex'))

@@ -242,4 +237,8 @@ if (peerInfo && peerInfo.banned) return true

const existing = this._allConnections.get(conn.remotePublicKey)
if (existing) {
if (existing.isInitiator && isOpen(existing)) {
// if both connections are from the same peer, pick newest. otherwise tie break based on pub keys
const keepNew = conn.isInitiator === existing.isInitiator || b4a.compare(conn.publicKey, conn.remotePublicKey) > 0
if (keepNew === false) {
conn.on('error', noop)

@@ -249,2 +248,3 @@ conn.destroy(new Error(ERR_DUPLICATE))

}
existing.on('error', noop)

@@ -434,5 +434,1 @@ existing.destroy(new Error(ERR_DUPLICATE))

}
function isOpen (stream) {
return !!stream.id
}
{
"name": "hyperswarm",
"version": "4.3.5",
"version": "4.3.6",
"description": "A distributed networking stack for connecting peers",

@@ -30,3 +30,3 @@ "files": [

"type": "git",
"url": "https://github.com/hyperswarm/hyperswarm.git"
"url": "https://github.com/holepunchto/hyperswarm.git"
},

@@ -40,5 +40,5 @@ "author": "Mathias Buus (@mafintosh)",

"bugs": {
"url": "https://github.com/hyperswarm/hyperswarm/issues"
"url": "https://github.com/holepunchto/hyperswarm/issues"
},
"homepage": "https://github.com/hyperswarm/hyperswarm"
"homepage": "https://github.com/holepunchto/hyperswarm"
}
# hyperswarm
### [See the full API docs at docs.holepunch.to](https://docs.holepunch.to/building-blocks/hyperswarm)
A high-level API for finding and connecting to peers who are interested in a "topic."

@@ -7,3 +9,3 @@

```
npm install hyperswarm@next
npm install hyperswarm
```

@@ -14,2 +16,3 @@

const Hyperswarm = require('hyperswarm')
const swarm1 = new Hyperswarm()

@@ -19,8 +22,9 @@ const swarm2 = new Hyperswarm()

swarm1.on('connection', (conn, info) => {
// swarm1 will receive server connections
conn.write('this is a server connection')
conn.end()
// swarm1 will receive server connections
conn.write('this is a server connection')
conn.end()
})
swarm2.on('connection', (conn, info) => {
conn.on('data', data => console.log('client got message:', data.toString()))
conn.on('data', data => console.log('client got message:', data.toString()))
})

@@ -56,6 +60,6 @@

See the [`PeerInfo`](https://github.com/hyperswarm/hyperswarm/blob/v3/README.md#peerinfo-api) API for more details.
See the [`PeerInfo`](https://github.com/holepunchto/hyperswarm/blob/v3/README.md#peerinfo-api) API for more details.
#### `swarm.dht`
A [`@hyperswarm/dht`](https://github.com/hyperswarm/dht) instance. Useful if you want lower-level control over Hyperswarm's networking.
A [`@hyperswarm/dht`](https://github.com/holepunchto/hyperswarm-dht) instance. Useful if you want lower-level control over Hyperswarm's networking.

@@ -67,3 +71,3 @@ #### `swarm.on('connection', (socket, peerInfo) => {})`

`peerInfo` is a [`PeerInfo`](https://github.com/hyperswarm/hyperswarm/blob/v3/README.md#peerinfo-api) instance
`peerInfo` is a [`PeerInfo`](https://github.com/holepunchto/hyperswarm/blob/v3/README.md#peerinfo-api) instance

@@ -78,3 +82,3 @@ #### `const discovery = swarm.join(topic, opts = {})`

Returns a [`PeerDiscovery`](https://github.com/hyperswarm/hyperswarm/blob/v3/README.md#peerdiscovery-api) object.
Returns a [`PeerDiscovery`](https://github.com/holepunchto/hyperswarm/blob/v3/README.md#peerdiscovery-api) object.

@@ -112,3 +116,3 @@ #### Clients and Servers

#### `const discovery = swarm.status(topic)`
Get the [`PeerDiscovery`](https://github.com/hyperswarm/hyperswarm/blob/v3/README.md#peerdiscovery-api) object associated with the topic, if it exists.
Get the [`PeerDiscovery`](https://github.com/holepunchto/hyperswarm/blob/v3/README.md#peerdiscovery-api) object associated with the topic, if it exists.

@@ -115,0 +119,0 @@ #### `await swarm.listen()`

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