fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-29 01:06:07 +02:00
parent fb76ecfd8a
commit 3856a1d7fb
6 changed files with 69 additions and 19 deletions

57
package-lock.json generated
View File

@ -259,13 +259,14 @@
"integrity": "sha512-9kHBWyDFjQ6cV1rseOfge02EH6huh/mrtqxlFoJoxnMaGWf5F8H3UEsskBBUGI6QKE1Bl8evr74AIKWwJ0r/bA=="
},
"@pushrocks/smartrequest": {
"version": "1.1.27",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.27.tgz",
"integrity": "sha512-GJO6duKBro2oILtXduVQwxA50AzjHZbKP0P32OoiM+B1ftoQFf4D8zSs/SCljNKXUqS8SZ9IMQVlKLfRC4nu+A==",
"version": "1.1.35",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.35.tgz",
"integrity": "sha512-1DOnt0628rkxDnX0zIoPHFxBwvjp6iIYkyaZshzFeACARmc+1yRYKiEu5pDahwhWhrCkK7xaAL+iLqnxxp+tWg==",
"requires": {
"@pushrocks/smartpromise": "^3.0.2",
"@types/form-data": "^2.2.1",
"form-data": "^2.3.3"
"@pushrocks/smartpromise": "^3.0.5",
"@types/form-data": "^2.5.0",
"agentkeepalive": "^4.0.2",
"form-data": "^2.5.1"
}
},
"@pushrocks/smartrx": {
@ -453,9 +454,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/node": {
"version": "12.7.5",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.5.tgz",
"integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w=="
"version": "12.7.8",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.8.tgz",
"integrity": "sha512-FMdVn84tJJdV+xe+53sYiZS4R5yn1mAIxfj+DVoNiQjTYz1+OYmjwEZr1ev9nU0axXwda0QDbYl06QHanRVH3A=="
},
"@types/portscanner": {
"version": "2.1.0",
@ -504,6 +505,31 @@
"es6-promisify": "^5.0.0"
}
},
"agentkeepalive": {
"version": "4.0.2",
"resolved": "https://verdaccio.lossless.one/agentkeepalive/-/agentkeepalive-4.0.2.tgz",
"integrity": "sha512-A5gSniD4xMCYtSD4ilUHpQRB9ZbNjtIPittKUv7bA0j0UCwbT3EJBUYLKPJ/dtmaXRYWI2mG4/O90xbi7oahNw==",
"requires": {
"debug": "^4.1.0",
"depd": "^1.1.2",
"humanize-ms": "^1.2.1"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://verdaccio.lossless.one/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"ansi-256-colors": {
"version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz",
@ -887,6 +913,11 @@
"resolved": "https://verdaccio.lossless.one/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"depd": {
"version": "1.1.2",
"resolved": "https://verdaccio.lossless.one/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"diff": {
"version": "4.0.1",
"resolved": "https://verdaccio.lossless.one/diff/-/diff-4.0.1.tgz",
@ -1138,6 +1169,14 @@
"debug": "^3.1.0"
}
},
"humanize-ms": {
"version": "1.2.1",
"resolved": "https://verdaccio.lossless.one/humanize-ms/-/humanize-ms-1.2.1.tgz",
"integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=",
"requires": {
"ms": "^2.0.0"
}
},
"inflight": {
"version": "1.0.6",
"resolved": "https://verdaccio.lossless.one/inflight/-/inflight-1.0.6.tgz",

View File

@ -16,14 +16,14 @@
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.5",
"@types/node": "^12.7.8",
"tslint": "^5.20.0",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/smartnetwork": "^1.1.14",
"@pushrocks/smartpromise": "^3.0.5",
"@pushrocks/smartrequest": "^1.1.27",
"@pushrocks/smartrequest": "^1.1.35",
"@pushrocks/smartspawn": "^2.0.9",
"@pushrocks/smartsystem": "^2.0.9",
"@tsclass/tsclass": "^2.0.6",

View File

@ -14,7 +14,7 @@ tap.test('should start the testproxy', async () => {
tap.test('should supply reverse proxy config', async () => {
testProxy.updateReversConfigs([{
destinationIp: 'localhost',
destinationPort: '8080',
destinationPort: '3000',
hostName: 'central.eu',
privateKey: `-----BEGIN PRIVATE KEY-----
MIIJRQIBADANBgkqhkiG9w0BAQEFAASCCS8wggkrAgEAAoICAQDi2F/0kQr96mhe

View File

@ -112,9 +112,18 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
method: req.method,
headers: req.headers
},
true // lets make this streaming
true, // lets make this streaming
(request) => {
req.on('data', data => {
request.write(data);
});
req.on('end', data => {
request.end();
});
}
);
res.statusCode = response.statusCode;
console.log(response.statusCode);
for (const header of Object.keys(response.headers)) {
res.setHeader(header, response.headers[header]);
}
@ -128,11 +137,11 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
// Enable websockets
const wss = new plugins.ws.Server({ server: this.httpsServer });
wss.on('connection', (ws: plugins.ws) => {
wss.on('connection', (ws: plugins.wsDefault) => {
console.log('got connection for wsc');
const wscConnected = plugins.smartpromise.defer();
const wsc = new plugins.ws(this.router.routeWs(ws), {
const wsc = new plugins.wsDefault(this.router.routeWs(ws), {
headers: {
Host: ws.url
}
@ -157,7 +166,8 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
ws.close();
});
});
this.httpsServer.keepAliveTimeout = 61000;
this.httpsServer.headersTimeout = 65000;
this.httpsServer.listen(this.port);
console.log(`OK: now listening for new connections on port ${this.port}`);
}

View File

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

View File

@ -19,6 +19,7 @@ import * as smartsystem from '@pushrocks/smartsystem';
export { smartrequest, smartpromise, smartspawn, smartsystem };
// third party scope
import ws from 'ws';
import * as ws from 'ws';
import wsDefault from 'ws';
export { ws };
export { wsDefault, ws };