From 2170fe3518bdc4f1c0bb5729f7b32090c0af270c Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Thu, 5 Jan 2023 15:53:17 +0100 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/smartproxy.classes.networkproxy.ts | 5 ++--- ts/smartproxy.classes.router.ts | 8 -------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 39e633c..df85608 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartproxy', - version: '3.0.42', + version: '3.0.43', description: 'a proxy for handling high workloads of proxying' } diff --git a/ts/smartproxy.classes.networkproxy.ts b/ts/smartproxy.classes.networkproxy.ts index ea152d2..e2a10d3 100644 --- a/ts/smartproxy.classes.networkproxy.ts +++ b/ts/smartproxy.classes.networkproxy.ts @@ -247,14 +247,13 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= // Enable websockets const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer }); wss.on('connection', (ws: plugins.wsDefault, reqArg) => { - console.log(`got connection for wsc for ${reqArg.url}`); + console.log(`got connection for wsc for https://${req.get('host')}${reqArg.url}`); let wscConnectedDeferred: plugins.smartpromise.Deferred; ws.on('message', async (message) => { if (!wscConnectedDeferred) { wscConnectedDeferred = plugins.smartpromise.defer(); - const parsedUrl = plugins.url.parse(reqArg.url); - const wsc = new plugins.wsDefault(`${this.router.routeWs(reqArg)}${parsedUrl.path}`); + const wsc = new plugins.wsDefault(`${this.router.routeReq(reqArg)}${reqArg.url}`); wsc.on('open', () => { wscConnectedDeferred.resolve(wsc); diff --git a/ts/smartproxy.classes.router.ts b/ts/smartproxy.classes.router.ts index 29f7713..3bae01c 100644 --- a/ts/smartproxy.classes.router.ts +++ b/ts/smartproxy.classes.router.ts @@ -21,12 +21,4 @@ export class ProxyRouter { }); return correspodingReverseProxyConfig; } - - public routeWs(wsReq: plugins.http.IncomingMessage) { - const originalHost = plugins.url.parse(wsReq.url).host; - const correspodingReverseProxyConfig = this.reverseProxyConfigs.find((reverseConfig) => { - return reverseConfig.hostName === originalHost; - }); - return correspodingReverseProxyConfig.destinationIp; - } }