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

sloki-node-client

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sloki-node-client - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

src/tcpJayson.js

44

index.js

@@ -1,4 +0,7 @@

const implementedProtocols = ['tcp','tls'];
const implementedTransports = ['tcp','tls'];
const defaultOptions = {
applicationLayer:'jayson'
}
function Client(url) {
function Client(url, options) {
let client;

@@ -12,8 +15,10 @@ let e = url.match(/^([^:]+)/);

let proto;
options = Object.assign(defaultOptions, options||{});
let transportLayer;
if (e) {
proto = e[1].toLowerCase();
if (implementedProtocols.indexOf(proto)<0) {
throw new Error('URL does not contain any implemented protocol (' + implementedProtocols.join(',')+')');
transportLayer = e[1].toLowerCase();
if (implementedTransports.indexOf(transportLayer)<0) {
throw new Error('URL does not contain any implemented protocol (' + implementedTransports.join(',')+')');
return null;

@@ -23,3 +28,3 @@ }

if (proto === "tls") {
if (transportLayer === "tls") {
throw new Error('Protocol '+proto+' not yet implemented');

@@ -29,16 +34,23 @@ process.exit(-1);

if (proto === "tcp" || proto === "tls") {
if (transportLayer === "tcp" || transportLayer === "tls") {
url = url.replace(/(tcp|tls):\/\//,'').split(':');
let host = url[0];
let port = url[1];
let port = parseInt(url[1]);
let myClient;
if (proto === "tcp") {
const ClientTCP = require('./tcp');
return new ClientTCP(port, host);
switch (transportLayer) {
case "tcp":
switch (options.applicationLayer) {
case "jayson":
MyClient = require('./src/tcpJayson');
return new MyClient(port, host, options);
break;
default:
throw new Error('Unknow application layer '+options.applicationLayer);
}
case "tls":
throw new Error('Transport layer TLS not yet implemented');
}
if (proto === "tls") {
const ClientTLS = require('./tls');
return new require('./tls')(port, host);
}
console.log(MyClient);
}

@@ -45,0 +57,0 @@ }

{
"name": "sloki-node-client",
"version": "0.0.3",
"version": "0.0.4",
"description": "NodeJS Client for Sloki",

@@ -26,4 +26,4 @@ "main": "index.js",

"evillogger": "^1.2.2",
"uuid": "^3.3.2"
"hyperid": "^2.0.2"
}
}
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