Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
node-thrift-service
Advanced tools
use redis/zookeeper to publish thrift service, manage thrift server/client
node >= 4.0.0
Unlike other language, javascript
can use .apply
to call a function
, so calling the remote nodejs service only need to transport alias(of service), action(function of service, MUST BE A PROMISE/SYNC), params
.
By using Thrift
, it support two way to use this module:
nodejs service
, use the inner msg.thrift
use-defined.thrift
Features:
Warning: Thrift Server will listening on a port, so you need to config your Firewalls
npm install node-thrift-service
cd test
and run node server
, node client
.
ThriftServer
const ThriftServer = require('node-thrift-service').ThriftServer;
let server = new ThriftServer({
adapter: {
name : 'zookeeper',
options: {
connect : '127.0.0.1:2181',
timeout : 200000,
debug_level : ZooKeeper.ZOO_LOG_LEVEL_ERROR,
host_order_deterministic: false,
data_as_buffer : false
}
}
});
server.on('debug', console.log);
server.on('info', console.log);
server.on('error', console.error);
server.on('ready', (info) => {
console.log(info);
server.add({
alias : 'lodash',
service: _,
actions: ['isString', 'no_such_action']
});
});
// ThriftServer host: xx.xx.xx.xx , port: 7007
ThriftClient
const ThriftServer = require('node-thrift-service').ThriftClient;
let client = new ThriftClient({
adapter: {
name : 'zookeeper',
options: {
connect : '127.0.0.1:2181',
timeout : 200000,
debug_level : ZooKeeper.ZOO_LOG_LEVEL_ERROR,
host_order_deterministic: false,
data_as_buffer : false
}
}
});
client.on('debug', console.log);
client.on('info', console.log);
client.on('error', console.error);
client.on('ready', (info) => {
console.log(info);
client.call('lodash', 'isString', ['a']).then(console.log);
// true
client.call('lodash', 'no_such_action', []).catch(console.error);
// error
});
[options.adapter]
: optional {Object}, include:
name='zookeeper'
: {String} 'redis' or 'zookeeper'options
={} : redis: node_redis , zookeeper: node-zookeeper[options.services]
: optional {Object|Array}, each service include:
[alias]
: {Function|String} unique name of each service, or use service.name
or service.identity
service
: {Object} origin service object[actions]
: {Array|String} permissions, or allow all service actions, ONLY support PROMISE/SYNC[options.thrift]
: optional {Object}, include:
[port]
: {Number} if null, thrift server bind to an unused port (default to find a unused port increasing from 7007 or from this setting, Thrift Server will listening on this port, so you need to config your Firewalls)[host]
: {String} if null, use ipv4 from eth0(linux) en0(osx)[options.adapter]
: optional {Object}, include:
name='zookeeper'
: {String} 'redis' or 'zookeeper'options
={} : {Object} redis: node_redis , zookeeper: node-zookeeper[port]
: {Number} if null, thrift server bind to an unused port (default to find a unused port increasing from 7007 or from this setting, Thrift Server will listening on this port, so you need to config your Firewalls)[host]
: {String} if null, use ipv4 from eth0(linux) en0(osx)alias
: {String} alias of gen-nodejs proceesor // for search thrift serverprocessor
: gen-nodejs proceesor // see server.js#L102handler
: gen-nodejs handleroptions
: {Object} gen-nodejs options.add(services)
: invalid with 'use-defined gen-nodejs', return {Promise|bluebird}
[alias]
: {Function|String} unique name of each service, or use service.name
or service.identity
service
: {Object} origin service object[actions]
: {Array|String} permissions, or allow all service actions, ONLY support PROMISE/SYNC.on(EVENT)
:
ready
: server initial .on('ready', (info) => {...})
debug
: debug log .on('ready', (info) => {...})
info
: info log, .on('info', (info) => {...})
error
: error log, .on('info', (err) => {…})
.server()
get thrift.createServer.host()
get host.port()
get port[options.adapter]
: optional {Object}, include:
name='zookeeper'
: {String} 'redis' or 'zookeeper'options={}
: {Object} redis: node_redis , zookeeper: node-zookeeper[options.thrifts]
: optional {Object}, for user-defined
alias
{String} // for search thrift serverprocessor
{Object} // gen-nodejs thrift processor.call(alias, action, params, [callback])
: use inner msg.thrift
alias
{String} service alias nameaction
: {String} name of actionparams
: {Array} params of alias.action
result
with {Promise|bluebird} or callback(err, result)
.call(alias, [callback])
: for user-defined.thrift return thrift.createClient
alias
: {String} service alias nameclient
with {Promise|bluebird} or callback(err, client)
.on(EVENT)
:
ready
: server initial .on('ready', (info) => {...})
debug
: debug log .on('ready', (info) => {...})
info
: info log, .on('info', (info) => {...})
error
: error log, .on('info', (err) => {…})
npm test
or make test
or make test-cover
MIT
FAQs
use redis/zookeeper to publish thrift service, manage thrift server/client
The npm package node-thrift-service receives a total of 0 weekly downloads. As such, node-thrift-service popularity was classified as not popular.
We found that node-thrift-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.