smartproxy/ts/smartproxy.classes.smartproxy.ts
2019-08-22 12:49:29 +02:00

26 lines
828 B
TypeScript

import * as plugins from './smartproxy.plugins';
import { TProxyMasterCalls } from './smartproxy.classes.proxymaster';
export class SmartProxy {
public hostCandidates: plugins.tsclass.network.IReverseProxyConfig[] = [];
public proxyMasterFunctions: plugins.smartspawn.ModuleThread<TProxyMasterCalls>;
public addHostCandidate(hostCandidate: plugins.tsclass.network.IReverseProxyConfig) {
// TODO search for old hostCandidates with that target
this.hostCandidates.push(hostCandidate);
}
public async start () {
this.proxyMasterFunctions = await plugins.smartspawn.spawn<TProxyMasterCalls>(new plugins.smartspawn.Worker('./smartproxy.classes.proxymaster'));
console.log('successfully spawned proxymaster');
}
public async stop () {
await this.proxyMasterFunctions.terminateMaster();
}
}