Comparing version 0.0.0 to 0.0.1
@@ -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; | ||
}; |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10745
307
3
4
2
+ Addedbatch@*
+ Addedbatch@0.6.1(transitive)