
Research
PyPI Package Impersonates SymPy to Deliver Cryptomining Malware
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.
grenache-nodejs-http
Advanced tools
Grenache is a micro-framework for connecting microservices. Its simple and optimized for performance.
Internally, Grenache uses Distributed Hash Tables (DHT, known from Bittorrent) for Peer to Peer connections. You can find more details how Grenche internally works at the Main Project Homepage
npm install --save grenache-nodejs-http
Install Grenache Grape: https://github.com/bitfinexcom/grenache-grape:
npm i -g grenache-grape
// Start 2 Grapes
grape --dp 20001 --aph 30001 --bn '127.0.0.1:20002'
grape --dp 20002 --aph 40001 --bn '127.0.0.1:20001'
This RPC Server example announces a service called rpc_test
on the overlay network. When a request from a client is received,
it replies with world. It receives the payload hello from the
client.
The client sends hello and receives world from the server.
Internally the DHT is asked for the IP of the server and then the request is done as Peer-to-Peer request via websockets.
Grape:
grape --dp 20001 --aph 30001 --bn '127.0.0.1:20002'
grape --dp 20002 --aph 40001 --bn '127.0.0.1:20001'
Server:
const Link = require('grenache-nodejs-link')
const link = new Link({
grape: 'http://127.0.0.1:30001'
})
link.start()
const peer = new PeerRPCServer(link, {
timeout: 300000
})
peer.init()
const service = peer.transport('server')
service.listen(_.random(1000) + 1024)
setInterval(function () {
link.announce('rpc_test', service.port, {})
}, 1000)
service.on('request', (rid, key, payload, handler) => {
console.log(payload) // hello
handler.reply(null, 'world')
})
Client:
const Link = require('grenache-nodejs-link')
const link = new Link({
grape: 'http://127.0.0.1:30001'
})
link.start()
const peer = new PeerRPCClient(link, {})
peer.init()
peer.request('rpc_test', 'hello', { timeout: 10000 }, (err, data) => {
if (err) {
console.error(err)
process.exit(-1)
}
console.log(data) // world
})
Emitted when a request from a RPC client is received.
rid unique request idkey name of the servicepayload Payload sent by clienthandler Handler object, used to reply to a client.service.on('request', (rid, key, payload, handler) => {
handler.reply(null, 'world')
})
link <Object> Instance of a Link Classoptions <Object>
key <Buffer>cert <Buffer>ca <Buffer>requestCert <Boolean>rejectUnauthorized <Boolean>Creates a new instance of a PeerRPCServer, which connects to the DHT
using the passed link.
Sets the peer active. Must get called before we get a transport to set up a server.
Must get called after the peer is active. Sets peer into server- mode.
Lets the PeerRPCServer listen on the desired port. The port is
stored in the DHT.
Port of the server (set by listen(port)).
This RPC Server example announces a service called rpc_test
on the overlay network. When a request from a client is received,
it replies with world. It receives the payload hello from the
client.
The client sends hello and receives world from the server.
Internally the DHT is asked for the IP of the server and then the request is done as Peer-to-Peer request via websockets.
Server:
const Link = require('grenache-nodejs-link')
const link = new Link({
grape: 'http://127.0.0.1:30001'
})
link.start()
const peer = new PeerRPCServer(link, {})
peer.init()
const service = peer.transport('server')
service.listen(_.random(1000) + 1024)
setInterval(function () {
link.announce('rpc_test', service.port, {})
}, 1000)
service.on('request', (rid, key, payload, handler) => {
console.log(payload) // hello
handler.reply(null, 'world')
})
Client:
const Link = require('grenache-nodejs-link')
const link = new Link({
grape: 'http://127.0.0.1:30001'
})
link.start()
const peer = new PeerRPCClient(link, {})
peer.init()
peer.request('rpc_test', 'hello', { timeout: 10000 }, (err, data) => {
if (err) {
console.error(err)
process.exit(-1)
}
console.log(data) // world
})
link <Object> Instance of a Link Classoptions <Object>
maxActiveKeyDests <Number>maxActiveDestTransports <Number>secure: <Object> TLS options
key <Buffer>cert <Buffer>ca <Buffer>rejectUnauthorized <Boolean>Creates a new instance of a PeerRPCClient, which connects to the DHT
using the passed link.
A PeerRPCClient can communicate with multiple Servers and map work items over them.
With maxActiveKeyDests you can limit the maximum amount of destinations.
Additionally, you can limit the amount of transports with maxActiveDestTransports.
Sets the peer active. Must get called before we start to make requests.
name <String> Name of the service to addresspayload <String> Payload to sendoptions <Object> Options for the request
timeout <Number> timeout in mslimit <Number> maximum requests per available workercallback <function>Maps a number of requests over the amount of registered workers / PeerRPCServers. Example.
name <String> Name of the service to addresspayload <String> Payload to sendoptions <Object> Options for the request
timeout <Number> timeout in msretry <Number> attempts to make before giving up. default is 1excludeDests <Array> list of dest nodes to exclude. For example, a service can exclude itself with excludeDests: [127.0.0.1:${this.grc_bfx.service.port}]continueOnErrors <Boolean> continue async map operations even if one of them errors. This utilizes a non standard way to handle errors by returning an Error object as the result. To handle errors with continueOnErrors, you must check each result to see if it is an instance of Error before using itcallback <function>Sends a single request to a RPC server/worker. Example.
FAQs
Granache Node.js HTTP implementation
The npm package grenache-nodejs-http receives a total of 67 weekly downloads. As such, grenache-nodejs-http popularity was classified as not popular.
We found that grenache-nodejs-http demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.