adds query instances function

This commit is contained in:
Zachary Boyd 2017-11-12 14:54:47 -08:00
parent de6ce4b936
commit f081dbd2fd
2 changed files with 7 additions and 1 deletions

View file

@ -16,7 +16,7 @@
"devDependencies": {
"mocha": "^3.2.0",
"request": "^2.79.0",
"socket.io-client": "^1.7.3",
"socket.io-client": "^1.7.4",
"socks5-http-client": "^1.0.2"
},
"dependencies": {

View file

@ -21,6 +21,12 @@ class ControlServer {
socket.on('createTorPool', this.createTorPool.bind(this));
socket.on('createSOCKSServer', this.createSOCKSServer.bind(this));
socket.on('createDNSServer', this.createDNSServer.bind(this));
socket.on('queryInstances', (callback) => {
if (!this.torPool)
return callback({ message: 'No pool created' });
callback(null, this.torPool.instances.map((i) => ( { dns_port: i.dns_port, socks_port: i.socks_port, process_id: i.process.pid } )) );
});
socket.on('createInstances', (instances, callback) => { this.torPool.create(instances, (error, instances) => {
callback && callback(error)