Socket
Socket
Sign inDemoInstall

@deadlock-delegate/crawler

Package Overview
Dependencies
17
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.10 to 1.3.0

18

app.js

@@ -46,3 +46,3 @@ const Crawler = require('./src/crawler')

console.log(`===========================================`)
console.log('===========================================')
console.log(`All nodes: ${Object.keys(crawler.nodes).length}`)

@@ -53,4 +53,4 @@ console.log(`Nodes online: ${crawler.heights.length}`)

// height/block stats
console.log(``)
console.log(`Height and block stats:`)
console.log('')
console.log('Height and block stats:')
for (const stat of orderBy(Object.values(blockStats), ['height'], ['desc'])) {

@@ -64,4 +64,4 @@ console.log(` ${stat.height} with ${stat.count} nodes. Block hashes:`)

// version stats
console.log(``)
console.log(`Version stats:`)
console.log('')
console.log('Version stats:')
for (const stat of orderBy(Object.values(versionStats), ['version'], ['desc'])) {

@@ -72,4 +72,4 @@ console.log(` - ${stat.version} on ${stat.count} nodes`)

// delay stats
console.log(``)
console.log(`Delay`)
console.log('')
console.log('Delay')
console.log(` Avg: ${averageDelay}ms`)

@@ -79,3 +79,3 @@ console.log(` Min: ${minDelay}ms`)

console.log(`------------------------------------------`)
console.log('------------------------------------------')
console.log(`Finished scanning in ${new Date() - crawler.startTime}ms`)

@@ -86,3 +86,3 @@

let node = { ip: undefined, port: undefined }
const node = { ip: undefined, port: undefined }
if (args.length === 1) {

@@ -89,0 +89,0 @@ const url = new URL(args[0])

{
"name": "@deadlock-delegate/crawler",
"version": "1.2.10",
"version": "1.3.0",
"description": "Crawler scans the ARK network to get information about the peers in the network.",

@@ -27,13 +27,13 @@ "main": "src/crawler.js",

"devDependencies": {
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0"
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1"
},
"dependencies": {
"lodash": "^4.17.11",
"lodash": "^4.17.15",
"socketcluster-client": "^14.2.2"
}
}

@@ -5,6 +5,10 @@ # Crawler

**Branches**
- master: is for Ark v2.4 node and higher which **uses websockets** for p2p instead of api
- v2.3: is for any Ark node that's lower than v2.4 which **does not use websockets** yet
#### ❤️ Support maintenance and development of plugins
If you find this or other plugins useful please consider
- voting for `deadlock` delegate
- donating to `AWtgFYbvtLDYccJvC5MChk4dpiUy2Krt2U`
to support development new plugins and tools for Ark's Ecosystem and maintenance of existing ones. Full list of contributions can be found on [https://arkdelegatesio/delegate/deadlock/](https://arkdelegates.io/delegate/deadlock/contributions/). 🖖
## Installation

@@ -11,0 +15,0 @@

@@ -13,11 +13,11 @@ const { map } = require('lodash')

*/
constructor (timeout = 3000, disconnect = true, sampleSize = 10) {
constructor (timeout = 2500, disconnect = true, sampleSize = 10) {
this.headers = {}
this.timeout = timeout
this.headers = {}
this.socket = undefined
this.disconnect = disconnect
this.request = {
data: {},
headers: {
nethash: 'no-nethash',
version: 'no-version'
'Content-Type': 'application/json'
}

@@ -27,3 +27,3 @@ }

this.peers = new Peers()
this.peers = new Peers(this.timeout)
}

@@ -50,8 +50,8 @@

try {
console.log(`... discovering network peers`)
console.log('... discovering network peers')
await this.discoverPeers(peer)
console.log(`... scanning network`)
console.log('... scanning network')
await this.scanNetwork()
if (this.disconnect) {
console.log(`... disconnecting from all peers`)
console.log('... disconnecting from all peers')
this.peers.disconnectAll()

@@ -67,3 +67,3 @@ }

async discoverPeers (peer) {
return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
const connection = this.peers.get(peer.ip)

@@ -111,3 +111,2 @@ if (!connection) {

})
Promise.all(samplePeers).then(resolve)

@@ -126,3 +125,2 @@ }

}
connection.emit(

@@ -129,0 +127,0 @@ 'p2p.peer.getStatus',

const SocketClient = require('socketcluster-client')
class Peers {
constructor () {
constructor (timeout = 2500) {
this.timeout = timeout
this.connections = new Map()

@@ -13,8 +14,21 @@ }

}
connection = SocketClient.create({ hostname: ip, port, connectTimeout: 2000 })
connection.on('error', (err) => {
console.error(err)
connection = SocketClient.create({
hostname: ip,
port,
connectTimeout: this.timeout,
ackTimeout: this.timeout,
perMessageDeflate: true
})
const socket = connection.transport.socket
if (socket._receiver) {
socket._receiver._maxPayload = 100 * 1024
}
connection.on('error', () => {
connection.destroy()
this.connections.delete(ip)
})
this.connections.set(ip, connection)

@@ -21,0 +35,0 @@ return connection

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc