
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@metrics/daemon
Advanced tools
Daemon for collecting metrics over misc network protocols. Provides a stream for further piping of metrics.
Daemon for collecting metrics over a network. Provides a stream for further piping of metrics.
$ npm install @metrics/daemon
Set up a daemon with UDP on port 6000 as transport and pipes the incomming metrics into the @metrics/client
:
const Daemon = require('@metrics/daemon');
const Client = require('@metrics/client');
const daemon = new Daemon('udp', { port: 6000 });
const client = new Client();
daemon.pipe(client);
daemon.listen();
This module makes it possible to create a socket one can recieve metrics over. The socket can
be of different protocols (UDP, TCP etc) but the data trasmitted over it is expected to be of
the @metrics/metric
type. The recieved metrics can
be piped to other metric modules for further handling.
For sending metrics over a socket one are expected to use the @metrics/emitter
module.
The main purpose of this is to be able to collect metrics from multiple processes. Here is a simplified example of each worker in a cluster pushing metrics to the master and the master pushing the metric further:
const master = () => {
const daemon = new Daemon('udp', { port: 6000 });
const client = new Client();
daemon.pipe(client);
daemon.listen();
};
const worker = () => {
const emitter = new Emitter('udp', { port: 6000 });
const client = new Client();
client.pipe(emitter);
client.metric({
name: `worker_${cluster.worker.id}`,
description: `Worker number: ${cluster.worker.id}`,
value: 1,
});
};
const workers = [];
if (cluster.isMaster) {
for (let i = 0; i < (os.cpus().length - 1); i++) {
workers.push(cluster.fork());
}
master();
}
if (cluster.isWorker) {
worker();
}
See the cluster example in examples for a full example.
Create a new Daemon instance.
const Daemon = require('@metrics/daemon');
const daemon = new Daemon(transport, options);
What type of transport to use. Supported values are:
udp
- For UDP transport.An Object containing misc configuration for the selected transport. Please see each transport for which option which can be passed in.
Returns a Readable stream in object mode.
The Daemon instance has the following API:
Starts the daemon with the selected transport.
The following transports is supported:
UDP as a transport can be enabled by providing udp
to the transport argument on the
Daemon constructor. The UDP transport takes the following options (passed to the options
argument on the Daemon constructor):
Number
- The port to bind to. Default: 40400.String
- The address to bind to. Default: localhost.Function
- Any logger that implements the methods trace
, debug
, info
, warn
, error
and fatal
. Under the hood abslog is used. See that module for further information. If no logger is passed in, nothing will be logged.FAQs
Daemon for collecting metrics over misc network protocols. Provides a stream for further piping of metrics.
We found that @metrics/daemon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.