New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dattss

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dattss - npm Package Compare versions

Comparing version 0.1.5 to 0.1.7

test/utils/emitter.js

6

config.js

@@ -8,5 +8,7 @@ var fwk = require('fwk');

config['DATTSS_AUTH_KEY'] = 'DUMMY';
config['DATTSS_SERVER_HOST'] = 'agg.dattss.com';
config['DATTSS_SERVER_PORT'] = 80;
config['DATTSS_SERVER_HTTP_HOST'] = 'agg.dattss.com';
config['DATTSS_SERVER_HTTP_PORT'] = 80;
config['DATTSS_SERVER_UDP_HOST'] = 'udp.dattss.com';
config['DATTSS_SERVER_UDP_PORT'] = 8125;
exports.config = config;

@@ -27,2 +27,3 @@ // Copyright Teleportd Ltd.

var http = require('http');
var socket = require('dgram').createSocket('udp4');

@@ -40,4 +41,6 @@

* DATTSS_AUTH_KEY: the auth key
* DATTSS_SERVER_HOST: the DaTtSs server host to use
* DATTSS_SERVER_PORT: the DaTtSs server port to use
* DATTSS_SERVER_HTTP_HOST: the DaTtSs server http host to use
* DATTSS_SERVER_HTTP_PORT: the DaTtSs server http port to use
* DATTSS_SERVER_UDP_HOST: the DaTtSs server udp host to use
* DATTSS_SERVER_UDP_PORT: the DaTtSs server udp port to use
* DATTSS_PERCENTILE : the percentile value (0.1 default)

@@ -47,3 +50,3 @@ *

*
* @param spec { auth, [host], [port], [pct] }
* @param spec { auth, [http_host], [http_port], [udp_host], [udp_port], [pct] }
*/

@@ -54,6 +57,8 @@ var dattss = function(spec, my) {

my.auth = spec.auth || exports.CONFIG['DATTSS_AUTH_KEY'];
my.host = spec.host || exports.CONFIG['DATTSS_SERVER_HOST'];
my.port = spec.port || parseInt(exports.CONFIG['DATTSS_SERVER_PORT'], 10);
my.pct = spec.pct || parseFloat(exports.CONFIG['DATTSS_PERCENTILE']);
my.auth = spec.auth || exports.CONFIG['DATTSS_AUTH_KEY'];
my.http_host = spec.http_host || exports.CONFIG['DATTSS_SERVER_HTTP_HOST'];
my.http_port = spec.http_port || parseInt(exports.CONFIG['DATTSS_SERVER_HTTP_PORT'], 10);
my.udp_host = spec.udp_host || exports.CONFIG['DATTSS_SERVER_UDP_HOST'];
my.udp_port = spec.udp_port || parseInt(exports.CONFIG['DATTSS_SERVER_UDP_PORT'], 10);
my.pct = spec.pct || parseFloat(exports.CONFIG['DATTSS_PERCENTILE']);

@@ -159,4 +164,4 @@ my.name = spec.name || 'noname';

var options = {
host: my.host,
port: my.port,
host: my.http_host,
port: my.http_port,
method: 'PUT',

@@ -187,5 +192,8 @@ path: '/agg?auth=' + my.auth,

* @param value a DaTtSs-like value '1c' | '253ms' | '34g'
* @param udp use direct udp delivery (no pre-aggregation)
*/
agg = function(stat, value) {
var stat_m = /^([A-Za-z0-9\-\_\.\:\!]+)$/.exec(stat);
agg = function(stat, value, udp) {
if(my.stopped)
return;
var stat_m = /^([A-Za-z0-9\-_\.\!]+)$/.exec(stat);
if(!stat_m)

@@ -200,6 +208,17 @@ return; // fail silently

my.acc[typ][stat] = my.acc[typ][stat] || [];
my.acc[typ][stat].push({ date: Date.now(),
value: val,
emphasis: emph });
if(!udp) {
my.acc[typ][stat] = my.acc[typ][stat] || [];
my.acc[typ][stat].push({ date: Date.now(),
value: val,
emphasis: emph });
}
else {
var body = my.auth + ':' + my.name + ':' + stat + ':' + value;
body = new Buffer(body);
socket.send(body, 0, body.length,
my.udp_port, my.udp_host,
function(err, bytes) {
// fail silently
});
}
}

@@ -253,3 +272,7 @@ };

*
* @param spec { name, [auth], [host], [port], [pct] } or just name as a string
* @param spec { name, [auth],
* [http_host], [http_port],
* [udp_host], [udp_port],
* [pct] }
* or just name as a string
* @return a dattss process object

@@ -267,7 +290,9 @@ */

spec.auth = spec.auth || exports.CONFIG['DATTSS_AUTH_KEY'];
spec.host = spec.host || exports.CONFIG['DATTSS_SERVER_HOST'];
spec.port = spec.port || parseInt(exports.CONFIG['DATTSS_SERVER_PORT'], 10);
spec.pct = spec.pct || parseFloat(exports.CONFIG['DATTSS_PERCENTILE']);
spec.name = spec.name || 'noname';
spec.auth = spec.auth || exports.CONFIG['DATTSS_AUTH_KEY'];
spec.http_host = spec.http_host || exports.CONFIG['DATTSS_SERVER_HTTP_HOST'];
spec.http_port = spec.http_port || parseInt(exports.CONFIG['DATTSS_SERVER_HTTP_PORT'], 10);
spec.udp_host = spec.udp_host || exports.CONFIG['DATTSS_SERVER_UDP_HOST'];
spec.udp_port = spec.udp_port || parseInt(exports.CONFIG['DATTSS_SERVER_UDP_PORT'], 10);
spec.pct = spec.pct || parseFloat(exports.CONFIG['DATTSS_PERCENTILE']);
spec.name = spec.name || 'noname';

@@ -274,0 +299,0 @@ cache[spec.auth] = cache[spec.auth] || {};

{
"name": "dattss",
"version": "0.1.5",
"version": "0.1.7",
"description": "NodeJS Driver for DaTtSs",

@@ -5,0 +5,0 @@ "author": { "name": "Stanislas Polu",

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