fix(core): update

This commit is contained in:
Philipp Kunz 2022-07-29 01:52:34 +02:00
parent 17eaea4124
commit ca4ddade17
9 changed files with 28 additions and 55 deletions

View File

@ -12,20 +12,12 @@ stages:
- release - release
- metadata - metadata
before_script:
- npm install -g @shipzone/npmci
# ==================== # ====================
# security stage # security stage
# ==================== # ====================
mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
@ -36,6 +28,7 @@ auditProductionDependencies:
- npmci command npm audit --audit-level=high --only=prod --production - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
allow_failure: true
auditDevDependencies: auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
@ -96,10 +89,9 @@ codequality:
only: only:
- tags - tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g typescript
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- lossless - lossless
- docker - docker
@ -119,11 +111,10 @@ trigger:
pages: pages:
stage: metadata stage: metadata
script: script:
- npmci node install lts - npmci node install stable
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command npm run buildDocs
tags: tags:
- lossless - lossless
- docker - docker

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "current file", "command": "npm test",
"type": "node", "name": "Run npm test",
"request": "launch", "request": "launch",
"args": [ "type": "node-terminal"
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
} }
] ]
} }

View File

@ -5,7 +5,7 @@
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "pushrocks",
"gitrepo": "smartproxy", "gitrepo": "smartproxy",
"shortDescription": "a proxy for handling high workloads of proxying", "description": "a proxy for handling high workloads of proxying",
"npmPackagename": "@pushrocks/smartproxy", "npmPackagename": "@pushrocks/smartproxy",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "projectDomain": "push.rocks"

View File

@ -11,7 +11,8 @@
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild --web --allowimplicitany)", "build": "(tsbuild --web --allowimplicitany)",
"format": "(gitzone format)" "format": "(gitzone format)",
"buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.63", "@gitzone/tsbuild": "^2.1.63",
@ -44,4 +45,4 @@
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ]
} }

View File

@ -5,7 +5,7 @@ let testProxy: smartproxy.NetworkProxy;
tap.test('first test', async () => { tap.test('first test', async () => {
testProxy = new smartproxy.NetworkProxy({ testProxy = new smartproxy.NetworkProxy({
port: 3001 port: 3001,
}); });
expect(testProxy).toBeInstanceOf(smartproxy.NetworkProxy); expect(testProxy).toBeInstanceOf(smartproxy.NetworkProxy);
}); });

View File

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

View File

@ -1,2 +1,2 @@
export * from './smartproxy.classes.networkproxy.js' export * from './smartproxy.classes.networkproxy.js';
export * from './smartproxy.portproxy.js'; export * from './smartproxy.portproxy.js';

View File

@ -6,7 +6,6 @@ export interface INetworkProxyOptions {
} }
export class NetworkProxy { export class NetworkProxy {
// INSTANCE // INSTANCE
public options: INetworkProxyOptions; public options: INetworkProxyOptions;
public proxyConfigs: plugins.tsclass.network.IReverseProxyConfig[] = []; public proxyConfigs: plugins.tsclass.network.IReverseProxyConfig[] = [];
@ -248,7 +247,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
}); });
}); });
this.httpsServer.keepAliveTimeout = 61000; this.httpsServer.keepAliveTimeout = 61000;
this.httpsServer.headersTimeout = 65000; this.httpsServer.headersTimeout = 65000;
this.httpsServer.on('connection', (connection: plugins.net.Socket) => { this.httpsServer.on('connection', (connection: plugins.net.Socket) => {
connection.setTimeout(120000); connection.setTimeout(120000);
@ -276,7 +275,9 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
}); });
this.httpsServer.listen(this.options.port); this.httpsServer.listen(this.options.port);
console.log(`ProxyWorker -> OK: now listening for new connections on port ${this.options.port}`); console.log(
`ProxyWorker -> OK: now listening for new connections on port ${this.options.port}`
);
} }
public async updateProxyConfigs(proxyConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]) { public async updateProxyConfigs(proxyConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]) {
@ -310,9 +311,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
this.httpsServer.listen(this.port); */ this.httpsServer.listen(this.port); */
} }
public async addDefaultHeaders(headersArg: { public async addDefaultHeaders(headersArg: { [key: string]: string }) {
[key: string]: string;
}) {
for (const headerKey of Object.keys(headersArg)) { for (const headerKey of Object.keys(headersArg)) {
this.defaultHeaders[headerKey] = headersArg[headerKey]; this.defaultHeaders[headerKey] = headersArg[headerKey];
} }

View File

@ -9,10 +9,10 @@ export class PortProxy {
constructor(fromPortArg: number, toPortArg: number) { constructor(fromPortArg: number, toPortArg: number) {
this.fromPort = fromPortArg; this.fromPort = fromPortArg;
this.toPort = toPortArg this.toPort = toPortArg;
} }
public async start () { public async start() {
httpServer = plugins.http.createServer((request, response) => { httpServer = plugins.http.createServer((request, response) => {
const requestUrl = new URL(request.url, `http://${request.headers.host}`); const requestUrl = new URL(request.url, `http://${request.headers.host}`);
const completeUrlWithoutProtocol = `${requestUrl.host}${requestUrl.pathname}${requestUrl.search}`; const completeUrlWithoutProtocol = `${requestUrl.host}${requestUrl.pathname}${requestUrl.search}`;
@ -34,7 +34,7 @@ export class PortProxy {
to.unpipe(); to.unpipe();
from.destroy(); from.destroy();
to.destroy(); to.destroy();
} };
netServer = net netServer = net
.createServer((from) => { .createServer((from) => {
const to = net.createConnection({ const to = net.createConnection({
@ -64,10 +64,10 @@ export class PortProxy {
}); });
from.on('end', () => { from.on('end', () => {
cleanUpSockets(from, to); cleanUpSockets(from, to);
}) });
to.on('end', () => { to.on('end', () => {
cleanUpSockets(from, to); cleanUpSockets(from, to);
}) });
}) })
.listen(this.fromPort); .listen(this.fromPort);
console.log(`PortProxy -> OK: Now listening on port ${this.fromPort}`); console.log(`PortProxy -> OK: Now listening on port ${this.fromPort}`);
@ -82,4 +82,4 @@ export class PortProxy {
}); });
await done.promise; await done.promise;
} }
}; }