adds query instances function
This commit is contained in:
parent
de6ce4b936
commit
f081dbd2fd
|
@ -16,7 +16,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "^3.2.0",
|
"mocha": "^3.2.0",
|
||||||
"request": "^2.79.0",
|
"request": "^2.79.0",
|
||||||
"socket.io-client": "^1.7.3",
|
"socket.io-client": "^1.7.4",
|
||||||
"socks5-http-client": "^1.0.2"
|
"socks5-http-client": "^1.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -21,6 +21,12 @@ class ControlServer {
|
||||||
socket.on('createTorPool', this.createTorPool.bind(this));
|
socket.on('createTorPool', this.createTorPool.bind(this));
|
||||||
socket.on('createSOCKSServer', this.createSOCKSServer.bind(this));
|
socket.on('createSOCKSServer', this.createSOCKSServer.bind(this));
|
||||||
socket.on('createDNSServer', this.createDNSServer.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) => {
|
socket.on('createInstances', (instances, callback) => { this.torPool.create(instances, (error, instances) => {
|
||||||
callback && callback(error)
|
callback && callback(error)
|
||||||
|
|
Loading…
Reference in a new issue