Compare commits

...

8 Commits

Author SHA1 Message Date
d5d77af98d 3.0.46 2023-01-05 17:28:55 +01:00
1f1bf77807 fix(core): update 2023-01-05 17:28:54 +01:00
d4269d290d 3.0.45 2023-01-05 17:21:42 +01:00
e05e5ede55 fix(core): update 2023-01-05 17:21:41 +01:00
b6c7f13baa 3.0.44 2023-01-05 17:00:32 +01:00
055d328bd0 fix(core): update 2023-01-05 17:00:31 +01:00
20b9a220fc 3.0.43 2023-01-05 15:53:17 +01:00
2170fe3518 fix(core): update 2023-01-05 15:53:17 +01:00
4 changed files with 5 additions and 14 deletions

View File

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

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartproxy',
version: '3.0.42',
version: '3.0.46',
description: 'a proxy for handling high workloads of proxying'
}

View File

@ -246,15 +246,14 @@ 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}`);
wss.on('connection', (ws: plugins.wsDefault, reqArg: plugins.http.IncomingMessage) => {
console.log(`got connection for wsc for https://${reqArg.headers.host}${reqArg.url}`);
let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>;
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(`wss://${this.router.routeReq(reqArg).destinationIp}${reqArg.url}`);
wsc.on('open', () => {
wscConnectedDeferred.resolve(wsc);

View File

@ -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;
}
}