diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ccbdd47..e276113 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,7 @@ # gitzone ci_default image: registry.gitlab.com/hosttoday/ht-docker-node:npmci +variables: + GIT_STRATEGY: clone cache: paths: diff --git a/package.json b/package.json index 2db3bce..9acb699 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "license": "MIT", "scripts": { "test": "(tstest test/)", - "build": "(tsbuild)", + "build": "(tsbuild --web)", "format": "(gitzone format)" }, "devDependencies": { @@ -41,4 +41,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index 73c2869..7a5074e 100644 --- a/test/test.ts +++ b/test/test.ts @@ -15,7 +15,7 @@ tap.test('should start the testproxy', async () => { await testProxy.start(); }); -tap.test('should wait for 5 seconds', async (tools) => { +tap.test('should wait for 5 seconds', async tools => { await tools.delayFor(1000); }); diff --git a/ts/smartproxy.classes.proxyworker.ts b/ts/smartproxy.classes.proxyworker.ts index 3c8a410..29aecec 100644 --- a/ts/smartproxy.classes.proxyworker.ts +++ b/ts/smartproxy.classes.proxyworker.ts @@ -47,19 +47,19 @@ export class ProxyWorker { wscConnected.resolve(); }); - ws.on('message', async (message) => { + ws.on('message', async message => { await wscConnected.promise; wsc.emit('message', message); }); - wsc.on('message', (message) => { + wsc.on('message', message => { ws.emit('message', message); }); // handle closing - ws.on('close', (message) => { + ws.on('close', message => { wsc.close(); }); - wsc.on('close', (message) => { + wsc.on('close', message => { ws.close(); }); }); @@ -103,4 +103,4 @@ const proxyWorkerCalls = { export type TProxyWorkerCalls = typeof proxyWorkerCalls; expose(proxyWorkerCalls); -console.log('ProxyWorker initialized'); \ No newline at end of file +console.log('ProxyWorker initialized'); diff --git a/ts/smartproxy.classes.smartproxy.ts b/ts/smartproxy.classes.smartproxy.ts index 4f98200..a167daf 100644 --- a/ts/smartproxy.classes.smartproxy.ts +++ b/ts/smartproxy.classes.smartproxy.ts @@ -9,7 +9,9 @@ export class SmartProxy { public proxyWorkerFunctions: plugins.smartspawn.ModuleThread; public portProxyFunctions: plugins.smartspawn.ModuleThread; - public async updateReversConfigs(reverseConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]) { + public async updateReversConfigs( + reverseConfigsArg: plugins.tsclass.network.IReverseProxyConfig[] + ) { // TODO search for old hostCandidates with that target this.reverseConfigs = reverseConfigsArg; if (this.proxyWorkerFunctions) { @@ -17,17 +19,21 @@ export class SmartProxy { } } - public async start () { - this.proxyWorkerFunctions = await plugins.smartspawn.spawn(new plugins.smartspawn.Worker('./smartproxy.classes.proxyworker')); + public async start() { + this.proxyWorkerFunctions = await plugins.smartspawn.spawn( + new plugins.smartspawn.Worker('./smartproxy.classes.proxyworker') + ); this.proxyWorkerFunctions.updateReverseConfigs(this.reverseConfigs); - - this.portProxyFunctions = await plugins.smartspawn.spawn(new plugins.smartspawn.Worker('./smartproxy.portproxy')); + + this.portProxyFunctions = await plugins.smartspawn.spawn( + new plugins.smartspawn.Worker('./smartproxy.portproxy') + ); await this.proxyWorkerFunctions.start(); - + console.log('successfully spawned portproxy and proxyworkers!'); } - public async stop () { + public async stop() { await this.proxyWorkerFunctions.stop(); await plugins.smartspawn.Thread.terminate(this.portProxyFunctions); console.log('proxy worker stopped'); @@ -36,6 +42,4 @@ export class SmartProxy { console.log('portproxy stopped'); console.log('Terminated all childs!'); } - - } diff --git a/ts/smartproxy.plugins.ts b/ts/smartproxy.plugins.ts index cfad2b7..264adcc 100644 --- a/ts/smartproxy.plugins.ts +++ b/ts/smartproxy.plugins.ts @@ -7,9 +7,7 @@ export { http, https }; // tsclass scope import * as tsclass from '@tsclass/tsclass'; -export { - tsclass -}; +export { tsclass }; // pushrocks scope import * as smartpromise from '@pushrocks/smartpromise'; @@ -17,16 +15,9 @@ import * as smartrequest from '@pushrocks/smartrequest'; import * as smartspawn from '@pushrocks/smartspawn'; import * as smartsystem from '@pushrocks/smartsystem'; -export { - smartrequest, - smartpromise, - smartspawn, - smartsystem, -}; +export { smartrequest, smartpromise, smartspawn, smartsystem }; // third party scope import * as ws from 'ws'; -export { - ws -}; +export { ws }; diff --git a/ts/smartproxy.portproxy.ts b/ts/smartproxy.portproxy.ts index e15a36f..b0ec4e3 100644 --- a/ts/smartproxy.portproxy.ts +++ b/ts/smartproxy.portproxy.ts @@ -1,14 +1,16 @@ import * as plugins from './smartproxy.plugins'; import { expose } from '@pushrocks/smartspawn'; import * as net from 'net'; -const server = net.createServer(from => { - const to = net.createConnection({ +const server = net + .createServer(from => { + const to = net.createConnection({ host: 'localhost', port: 8001 - }); - from.pipe(to); - to.pipe(from); -}).listen(8000); + }); + from.pipe(to); + to.pipe(from); + }) + .listen(8000); const portProxyCalls = { stop: async () => { @@ -23,4 +25,4 @@ const portProxyCalls = { export type TPortProxyCalls = typeof portProxyCalls; expose(portProxyCalls); -console.log('PortProxy Initialized'); \ No newline at end of file +console.log('PortProxy Initialized');