Compare commits

...

2 Commits

Author SHA1 Message Date
4113bf551e 1.0.21 2019-08-22 15:21:57 +02:00
2896c92c04 fix(core): update 2019-08-22 15:21:57 +02:00
3 changed files with 12 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartproxy", "name": "@pushrocks/smartproxy",
"version": "1.0.20", "version": "1.0.21",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartproxy", "name": "@pushrocks/smartproxy",
"version": "1.0.20", "version": "1.0.21",
"private": false, "private": false,
"description": "a proxy for handling high workloads of proxying", "description": "a proxy for handling high workloads of proxying",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -5,20 +5,26 @@ import { TPortProxyCalls } from './smartproxy.portproxy';
export class SmartProxy { export class SmartProxy {
public smartsystem = new plugins.smartsystem.Smartsystem(); public smartsystem = new plugins.smartsystem.Smartsystem();
public hostCandidates: plugins.tsclass.network.IReverseProxyConfig[] = []; public reverseConfigs: plugins.tsclass.network.IReverseProxyConfig[] = [];
public proxyWorkerFunctions: plugins.smartspawn.ModuleThread<TProxyWorkerCalls>; public proxyWorkerFunctions: plugins.smartspawn.ModuleThread<TProxyWorkerCalls>;
public portProxyFunctions: plugins.smartspawn.ModuleThread<TPortProxyCalls>; public portProxyFunctions: plugins.smartspawn.ModuleThread<TPortProxyCalls>;
public addHostCandidate(hostCandidate: plugins.tsclass.network.IReverseProxyConfig) { public async updateReversConfigs(reverseConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]) {
// TODO search for old hostCandidates with that target // TODO search for old hostCandidates with that target
this.hostCandidates.push(hostCandidate); this.reverseConfigs = reverseConfigsArg;
if (this.proxyWorkerFunctions) {
await this.proxyWorkerFunctions.updateReverseConfigs(this.reverseConfigs);
}
} }
public async start () { public async start () {
this.proxyWorkerFunctions = await plugins.smartspawn.spawn<TProxyWorkerCalls>(new plugins.smartspawn.Worker('./smartproxy.classes.proxyworker')); this.proxyWorkerFunctions = await plugins.smartspawn.spawn<TProxyWorkerCalls>(new plugins.smartspawn.Worker('./smartproxy.classes.proxyworker'));
this.proxyWorkerFunctions.updateReverseConfigs(this.reverseConfigs);
this.portProxyFunctions = await plugins.smartspawn.spawn<TPortProxyCalls>(new plugins.smartspawn.Worker('./smartproxy.portproxy')); this.portProxyFunctions = await plugins.smartspawn.spawn<TPortProxyCalls>(new plugins.smartspawn.Worker('./smartproxy.portproxy'));
console.log('successfully spawned proxymaster');
await this.proxyWorkerFunctions.start(); await this.proxyWorkerFunctions.start();
console.log('successfully spawned portproxy and proxyworkers!');
} }
public async stop () { public async stop () {