Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
42cbc51d22 | |||
2d16403ad1 | |||
afe847499a | |||
f980bb70b4 | |||
f192a8f041 | |||
64bf3aef6d | |||
a5e3cbd05b | |||
2f0fad999a | |||
5e6477720d | |||
bad8bf0688 | |||
4f1db106fb | |||
d47829a8b2 |
18
package-lock.json
generated
18
package-lock.json
generated
@ -1,17 +1,17 @@
|
||||
{
|
||||
"name": "@pushrocks/smartproxy",
|
||||
"version": "3.0.7",
|
||||
"version": "3.0.13",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pushrocks/smartproxy",
|
||||
"version": "3.0.7",
|
||||
"version": "3.0.13",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^6.0.0",
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
"@pushrocks/smartrequest": "^2.0.0",
|
||||
"@pushrocks/smartrequest": "^2.0.5",
|
||||
"@pushrocks/smartstring": "^4.0.2",
|
||||
"@tsclass/tsclass": "^4.0.17",
|
||||
"@types/ws": "^8.5.3",
|
||||
@ -1554,9 +1554,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@pushrocks/smartrequest": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-2.0.0.tgz",
|
||||
"integrity": "sha512-Xmi+2xYvy67aOMg+XO08RaIZ2QjZZonvz7lEFx5esFzu4LIbwYOzN3GEmZ6/gz9yqdGCBknUxTSLfKCO/hZgTg==",
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-2.0.5.tgz",
|
||||
"integrity": "sha512-oUvFJv1PWmvXgYjMKhmxCvJWu3SsTFpw8f3Wh/czwyAbudpB2IRQZw3fC/KaFF8zzUnvijPMP185wOcjvnQWYA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
@ -9973,9 +9973,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrequest": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-2.0.0.tgz",
|
||||
"integrity": "sha512-Xmi+2xYvy67aOMg+XO08RaIZ2QjZZonvz7lEFx5esFzu4LIbwYOzN3GEmZ6/gz9yqdGCBknUxTSLfKCO/hZgTg==",
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-2.0.5.tgz",
|
||||
"integrity": "sha512-oUvFJv1PWmvXgYjMKhmxCvJWu3SsTFpw8f3Wh/czwyAbudpB2IRQZw3fC/KaFF8zzUnvijPMP185wOcjvnQWYA==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
"@pushrocks/smarturl": "^3.0.2",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartproxy",
|
||||
"version": "3.0.7",
|
||||
"version": "3.0.13",
|
||||
"private": false,
|
||||
"description": "a proxy for handling high workloads of proxying",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -23,7 +23,7 @@
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^6.0.0",
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
"@pushrocks/smartrequest": "^2.0.0",
|
||||
"@pushrocks/smartrequest": "^2.0.5",
|
||||
"@pushrocks/smartstring": "^4.0.2",
|
||||
"@tsclass/tsclass": "^4.0.17",
|
||||
"@types/ws": "^8.5.3",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartproxy',
|
||||
version: '3.0.7',
|
||||
version: '3.0.13',
|
||||
description: 'a proxy for handling high workloads of proxying'
|
||||
}
|
||||
|
@ -117,9 +117,6 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
||||
`,
|
||||
},
|
||||
async (req, res) => {
|
||||
console.log('got request');
|
||||
const destinationConfig = this.router.routeReq(req);
|
||||
|
||||
/**
|
||||
* endRequest function
|
||||
* can be used to prematurely end a request
|
||||
@ -133,6 +130,15 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
||||
res.end(messageArg);
|
||||
};
|
||||
|
||||
console.log('got request');
|
||||
const destinationConfig = this.router.routeReq(req);
|
||||
|
||||
if (!destinationConfig) {
|
||||
console.log(`${req.headers.host} can't be routed properly. Terminating request.`);
|
||||
endRequest();
|
||||
return;
|
||||
}
|
||||
|
||||
// authentication
|
||||
if (destinationConfig.authentication) {
|
||||
const authInfo = destinationConfig.authentication;
|
||||
@ -250,14 +256,17 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
||||
this.httpsServer.headersTimeout = 65000;
|
||||
|
||||
this.httpsServer.on('connection', (connection: plugins.net.Socket) => {
|
||||
connection.setTimeout(120000);
|
||||
connection.setTimeout(10000);
|
||||
this.socketMap.add(connection);
|
||||
console.log(`added connection. now ${this.socketMap.getArray().length} sockets connected.`);
|
||||
const cleanupConnection = () => {
|
||||
if (this.socketMap.checkForObject(connection)) {
|
||||
this.socketMap.remove(connection);
|
||||
connection.end();
|
||||
connection.removeAllListeners();
|
||||
connection.destroy();
|
||||
console.log(`removed connection. ${this.socketMap.getArray().length} sockets remaining.`);
|
||||
connection.end(() => {
|
||||
connection.destroy();
|
||||
console.log(`socket successfully destroyed`);
|
||||
});
|
||||
}
|
||||
};
|
||||
connection.on('close', () => {
|
||||
|
Reference in New Issue
Block a user