Compare commits

...

16 Commits

Author SHA1 Message Date
20b9a220fc 3.0.43 2023-01-05 15:53:17 +01:00
2170fe3518 fix(core): update 2023-01-05 15:53:17 +01:00
04b13e53b9 3.0.42 2023-01-05 15:26:36 +01:00
f1a4fae704 fix(core): update 2023-01-05 15:26:36 +01:00
5ee5147606 3.0.41 2023-01-05 14:57:55 +01:00
748c6e14e4 fix(core): update 2023-01-05 14:57:54 +01:00
f018957de4 3.0.40 2023-01-04 15:59:59 +01:00
a6583b037c fix(core): update 2023-01-04 15:59:58 +01:00
3ab4144c9a 3.0.39 2023-01-04 15:59:32 +01:00
0d2885ace4 fix(core): update 2023-01-04 15:59:31 +01:00
1723275215 3.0.38 2022-08-06 22:42:05 +02:00
977d8b0310 fix(core): update 2022-08-06 22:42:05 +02:00
5bb065f82b 3.0.37 2022-08-04 17:16:27 +02:00
942b812f97 fix(core): update 2022-08-04 17:16:26 +02:00
59a025b308 3.0.36 2022-08-04 14:21:06 +02:00
458e7d6b58 fix(core): update 2022-08-04 14:21:05 +02:00
6 changed files with 4361 additions and 15010 deletions

14983
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartproxy", "name": "@pushrocks/smartproxy",
"version": "3.0.35", "version": "3.0.43",
"private": false, "private": false,
"description": "a proxy for handling high workloads of proxying", "description": "a proxy for handling high workloads of proxying",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -15,18 +15,19 @@
"buildDocs": "tsdoc" "buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.63", "@gitzone/tsbuild": "^2.1.65",
"@gitzone/tstest": "^1.0.72", "@gitzone/tsrun": "^1.2.39",
"@gitzone/tstest": "^1.0.73",
"@pushrocks/tapbundle": "^5.0.4", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.6.2" "@types/node": "^18.7.8"
}, },
"dependencies": { "dependencies": {
"@pushrocks/lik": "^6.0.0", "@pushrocks/lik": "^6.0.0",
"@pushrocks/smartdelay": "^2.0.13", "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartpromise": "^3.1.7", "@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartrequest": "^2.0.6", "@pushrocks/smartrequest": "^2.0.10",
"@pushrocks/smartstring": "^4.0.2", "@pushrocks/smartstring": "^4.0.2",
"@tsclass/tsclass": "^4.0.17", "@tsclass/tsclass": "^4.0.19",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"ws": "^8.8.1" "ws": "^8.8.1"
}, },

4341
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -186,7 +186,11 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
destinationUrl, destinationUrl,
{ {
method: originRequest.method, method: originRequest.method,
headers: originRequest.headers, headers: {
...originRequest.headers,
'X-Forwarded-Host': originRequest.headers.host,
'X-Forwarded-Proto': 'https'
},
keepAlive: true, keepAlive: true,
}, },
true, // lets make this streaming true, // lets make this streaming
@ -241,19 +245,15 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
); );
// Enable websockets // Enable websockets
const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer }); const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer });
wss.on('connection', (ws: plugins.wsDefault) => { wss.on('connection', (ws: plugins.wsDefault, reqArg) => {
console.log('got connection for wsc'); console.log(`got connection for wsc for https://${req.get('host')}${reqArg.url}`);
let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>; let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>;
ws.on('message', async (message) => { ws.on('message', async (message) => {
if (!wscConnectedDeferred) { if (!wscConnectedDeferred) {
wscConnectedDeferred = plugins.smartpromise.defer(); wscConnectedDeferred = plugins.smartpromise.defer();
const wsc = new plugins.wsDefault(this.router.routeWs(ws), { const wsc = new plugins.wsDefault(`${this.router.routeReq(reqArg)}${reqArg.url}`);
headers: {
Host: ws.url,
},
});
wsc.on('open', () => { wsc.on('open', () => {
wscConnectedDeferred.resolve(wsc); wscConnectedDeferred.resolve(wsc);
@ -280,8 +280,8 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
}); });
}); });
}); });
this.httpsServer.keepAliveTimeout = 61000; this.httpsServer.keepAliveTimeout = 600 * 1000;
this.httpsServer.headersTimeout = 65000; this.httpsServer.headersTimeout = 600 * 1000;
this.httpsServer.on('connection', (connection: plugins.net.Socket) => { this.httpsServer.on('connection', (connection: plugins.net.Socket) => {
this.socketMap.add(connection); this.socketMap.add(connection);
@ -309,7 +309,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
this.httpsServer.listen(this.options.port); this.httpsServer.listen(this.options.port);
console.log( console.log(
`ProxyWorker -> OK: now listening for new connections on port ${this.options.port}` `NetworkProxy -> OK: now listening for new connections on port ${this.options.port}`
); );
} }

View File

@ -21,12 +21,4 @@ export class ProxyRouter {
}); });
return correspodingReverseProxyConfig; return correspodingReverseProxyConfig;
} }
public routeWs(ws: plugins.wsDefault) {
const originalHost = plugins.url.parse(ws.url).host;
const correspodingReverseProxyConfig = this.reverseProxyConfigs.find((reverseConfig) => {
return reverseConfig.hostName === originalHost;
});
return correspodingReverseProxyConfig.destinationIp;
}
} }