Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

distroy

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

distroy - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

47

lib/server.js

@@ -5,5 +5,8 @@ /**

var net = require("net")
, fs = require("fs")
, path = require("path")
, EventEmitter = require("events").EventEmitter
, inherits = require("util").inherits
, sni = require("sni")
, Batch = require("Batch")
, util = require("./util");

@@ -182,2 +185,46 @@

return this;
};
/**
* Start or stop ping checking.
* @param {Number} interval
* @param {Number} timeout
* @return {Server} this
*/
Server.prototype.ping = function(interval, timeout) {
if(interval === false) {
clearInterval(this.pinger);
return this;
}
this.pinger = setInterval(ping.bind(this, timeout || 5 * 1000), interval || 60 * 1000);
};
function ping(timeout) {
var batch = new Batch.concurrency(4);
for(key in this.hosts) {
// TODO
batch.push(function() {});
}
}
/**
* Watch a directory for unix socket paths.
* @param {String} dir
* @param {Number} interval
* @return {Server} this
*/
Server.prototype.watch = function(dir, interval) {
mkdirp.sync(dir, 0777);
var self = this;
function traverseHosts() {
fs.readdirSync(dir).forEach(function(file) {
var key = path.join(dir, file);
if(!(key in self.hosts)) self.add(key);
});
}
setInterval(traverseHosts, interval || 3000);
traverseHosts();
return this;
};

22

package.json
{
"name": "distroy",
"description": "vHost Routing for HTTP and HTTPS",
"version": "0.0.0",
"version": "0.0.1",
"author": "Jan Buschtöns <buschtoens@gmail.com>",
"contributors": [
{ "name": "Jan Buschtöns", "email": "buschtoens@gmail.com", "url": "https://github.com/silvinci" }
"contributors": [
{
"name": "Jan Buschtöns",
"email": "buschtoens@gmail.com",
"url": "https://github.com/silvinci"
}
],
"license": "MIT",
"keywords": ["net", "http", "https", "vhost"],
"keywords": [
"net",
"http",
"https",
"vhost"
],
"repository": "git://github.com/silvinci/distroy",

@@ -15,4 +24,5 @@ "main": "index",

"sni": "*",
"mkdirp": "*"
"mkdirp": "*",
"batch": "*"
}
}
}

Sorry, the diff of this file is not supported yet

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