Compare commits

...

6 Commits

Author SHA1 Message Date
11344ac0df 2.0.9 2021-02-03 00:23:29 +00:00
85fcfc3c36 fix(core): update 2021-02-03 00:23:28 +00:00
e9ac7b2347 2.0.8 2021-02-03 00:16:11 +00:00
2c59540768 fix(core): update 2021-02-03 00:16:11 +00:00
0f82d63f5c 2.0.7 2021-02-03 00:13:30 +00:00
b5fcdadd3d fix(core): update 2021-02-03 00:13:29 +00:00
4 changed files with 10 additions and 2 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartproxy", "name": "@pushrocks/smartproxy",
"version": "2.0.6", "version": "2.0.9",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartproxy", "name": "@pushrocks/smartproxy",
"version": "2.0.6", "version": "2.0.9",
"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",

View File

@ -8,6 +8,7 @@ export class ProxyWorker {
public port = 8001; public port = 8001;
public router = new SmartproxyRouter(); public router = new SmartproxyRouter();
public socketMap = new plugins.lik.ObjectMap<plugins.net.Socket>(); public socketMap = new plugins.lik.ObjectMap<plugins.net.Socket>();
public defaultHeaders: {[key: string]: string} = {};
/** /**
* starts the proxyInstance * starts the proxyInstance
@ -174,6 +175,9 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
); );
res.statusCode = response.statusCode; res.statusCode = response.statusCode;
console.log(response.statusCode); console.log(response.statusCode);
for (const defaultHeader of Object.keys(this.defaultHeaders)) {
res.setHeader(defaultHeader, this.defaultHeaders[defaultHeader]);
}
for (const header of Object.keys(response.headers)) { for (const header of Object.keys(response.headers)) {
res.setHeader(header, response.headers[header]); res.setHeader(header, response.headers[header]);
} }
@ -270,6 +274,7 @@ const proxyWorkerCalls = {
updateReverseConfigs: async (configArray: plugins.tsclass.network.IReverseProxyConfig[]) => { updateReverseConfigs: async (configArray: plugins.tsclass.network.IReverseProxyConfig[]) => {
await proxyWorkerInstance.updateProxyConfigs(configArray); await proxyWorkerInstance.updateProxyConfigs(configArray);
}, },
addDefaultHeaders: async (headers: {[key: string]: string}) => {}
}; };
export type TProxyWorkerCalls = typeof proxyWorkerCalls; export type TProxyWorkerCalls = typeof proxyWorkerCalls;

View File

@ -25,6 +25,8 @@ const portProxyCalls = {
to.removeAllListeners(); to.removeAllListeners();
from.unpipe(); from.unpipe();
to.unpipe(); to.unpipe();
from.destroy();
to.destroy();
} }
netServer = net netServer = net
.createServer((from) => { .createServer((from) => {
@ -32,6 +34,7 @@ const portProxyCalls = {
host: 'localhost', host: 'localhost',
port: 8001, port: 8001,
}); });
from.setTimeout(120000);
from.pipe(to); from.pipe(to);
to.pipe(from); to.pipe(from);
from.on('error', () => { from.on('error', () => {