Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
7c4d9cf301 | |||
5ddee94f99 | |||
209e5644c0 | |||
128c9f9751 | |||
0dfb763b17 | |||
2883d2b926 |
@ -1,5 +1,7 @@
|
|||||||
# gitzone ci_default
|
# gitzone ci_default
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
variables:
|
||||||
|
GIT_STRATEGY: clone
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
@ -38,11 +40,11 @@ snyk:
|
|||||||
# test stage
|
# test stage
|
||||||
# ====================
|
# ====================
|
||||||
|
|
||||||
testLTS:
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci node install lts
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
|
96
package-lock.json
generated
96
package-lock.json
generated
@ -1,19 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartproxy",
|
"name": "@pushrocks/smartproxy",
|
||||||
"version": "1.0.21",
|
"version": "1.0.24",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@airbnb/node-memwatch": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/@airbnb%2fnode-memwatch/-/node-memwatch-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-2R+MEEMSTUdKwQ6NFWkyA/UNoSjL1tMldZqJbZpgXSwNMBzlNlkUWEXKu9RqTTMkDqJRfGJ2VDs8gPlPK2APDQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"bindings": "^1.3.0",
|
|
||||||
"nan": "^2.9.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@babel/code-frame": {
|
"@babel/code-frame": {
|
||||||
"version": "7.5.5",
|
"version": "7.5.5",
|
||||||
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz",
|
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz",
|
||||||
@ -307,14 +297,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartspawn": {
|
"@pushrocks/smartspawn": {
|
||||||
"version": "2.0.8",
|
"version": "2.0.9",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartspawn/-/smartspawn-2.0.8.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartspawn/-/smartspawn-2.0.9.tgz",
|
||||||
"integrity": "sha512-3ohykcFhQhsblWlc8uZddb/8EBXBhd7tv8oKcvA7EnM3PLLEn6GTM9rSptLWmdhYli7IZQW+rtHCZoSSY1/+9w==",
|
"integrity": "sha512-PKg4UWmIBc4kE92V91VNsarxaDu3EWvhNtxybvnka/V82m4iZVWKpxGYt0fLsUj6vqJDla/wnkZImiBTlYGLcg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"spawn-wrap": "^1.4.2",
|
"spawn-wrap": "^1.4.2",
|
||||||
"threads": "1.0.0-beta.4",
|
"threads": "1.0.0-beta.4"
|
||||||
"tiny-worker": "^2.2.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartstring": {
|
"@pushrocks/smartstring": {
|
||||||
@ -330,9 +319,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartsystem": {
|
"@pushrocks/smartsystem": {
|
||||||
"version": "2.0.7",
|
"version": "2.0.8",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsystem/-/smartsystem-2.0.7.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsystem/-/smartsystem-2.0.8.tgz",
|
||||||
"integrity": "sha512-YwRmwfFZGJCsy4xSW6HmUfWXiHgbBdsbuwVjYJ/fb2pQn4aYp2W2FL0S6gA4pofryQVkaUcxEjFEKTpfNjM1dA==",
|
"integrity": "sha512-lBruo1Ikai35oiDMy3Lx1NhddTMynCCd8MTx4dBU22a0HnNYZRKxTITuPAfIDD3VB94ZpEGbAvzblnZpuFFkMQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/lik": "^3.0.10",
|
"@pushrocks/lik": "^3.0.10",
|
||||||
"@pushrocks/smartenv": "^4.0.7",
|
"@pushrocks/smartenv": "^4.0.7",
|
||||||
@ -352,15 +341,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/tapbundle": {
|
"@pushrocks/tapbundle": {
|
||||||
"version": "3.0.11",
|
"version": "3.0.13",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.11.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.13.tgz",
|
||||||
"integrity": "sha512-s7epZfJZX+LsBVmIYvoaY4WtgPvRLnHZMVTpQAPJGMBqxJAQxhQ2wvGJjmqMAGhhznAHI6t4g+m0KTp3vFIRVg==",
|
"integrity": "sha512-23O4UMBafCuD+RnUlXNvtT9DGbL1HMD+xZE1Zcr7Ll7WvgxUgRQQfk9kq6qbLLbjaRe1J2Ijsgh1HuZbBaucLQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/early": "^3.0.3",
|
"@pushrocks/early": "^3.0.3",
|
||||||
"@pushrocks/smartdelay": "^2.0.3",
|
"@pushrocks/smartdelay": "^2.0.3",
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"leakage": "^0.4.0",
|
|
||||||
"smartchai": "^2.0.1"
|
"smartchai": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -554,15 +542,6 @@
|
|||||||
"resolved": "https://verdaccio.lossless.one/balanced-match/-/balanced-match-1.0.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||||
},
|
},
|
||||||
"bindings": {
|
|
||||||
"version": "1.5.0",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/bindings/-/bindings-1.5.0.tgz",
|
|
||||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"file-uri-to-path": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://verdaccio.lossless.one/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://verdaccio.lossless.one/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
@ -830,12 +809,6 @@
|
|||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"es6-error": {
|
|
||||||
"version": "4.1.1",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/es6-error/-/es6-error-4.1.1.tgz",
|
|
||||||
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"es6-promise": {
|
"es6-promise": {
|
||||||
"version": "4.2.8",
|
"version": "4.2.8",
|
||||||
"resolved": "https://verdaccio.lossless.one/es6-promise/-/es6-promise-4.2.8.tgz",
|
"resolved": "https://verdaccio.lossless.one/es6-promise/-/es6-promise-4.2.8.tgz",
|
||||||
@ -857,7 +830,8 @@
|
|||||||
"esm": {
|
"esm": {
|
||||||
"version": "3.2.25",
|
"version": "3.2.25",
|
||||||
"resolved": "https://verdaccio.lossless.one/esm/-/esm-3.2.25.tgz",
|
"resolved": "https://verdaccio.lossless.one/esm/-/esm-3.2.25.tgz",
|
||||||
"integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA=="
|
"integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==",
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"esprima": {
|
"esprima": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
@ -895,12 +869,6 @@
|
|||||||
"escape-string-regexp": "^1.0.5"
|
"escape-string-regexp": "^1.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"file-uri-to-path": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"find-up": {
|
"find-up": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/find-up/-/find-up-3.0.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/find-up/-/find-up-3.0.0.tgz",
|
||||||
@ -1147,25 +1115,6 @@
|
|||||||
"invert-kv": "^2.0.0"
|
"invert-kv": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"leakage": {
|
|
||||||
"version": "0.4.0",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/leakage/-/leakage-0.4.0.tgz",
|
|
||||||
"integrity": "sha512-x7gYK5n5dPkHDZWJ2Kh8Ag1hZNzUh+HtXn8Bv1aDdN6o6ONPCJ8sOfFq+kxcULJFp3lXaCjXb3iXOLmQRbBLwA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@airbnb/node-memwatch": "^1.0.2",
|
|
||||||
"es6-error": "^4.0.2",
|
|
||||||
"left-pad": "^1.1.3",
|
|
||||||
"minimist": "^1.2.0",
|
|
||||||
"pretty-bytes": "^4.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"left-pad": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/left-pad/-/left-pad-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"locate-path": {
|
"locate-path": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/locate-path/-/locate-path-3.0.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/locate-path/-/locate-path-3.0.0.tgz",
|
||||||
@ -1267,12 +1216,6 @@
|
|||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimist": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/minimist/-/minimist-1.2.0.tgz",
|
|
||||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"resolved": "https://verdaccio.lossless.one/mkdirp/-/mkdirp-0.5.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||||
@ -1306,12 +1249,6 @@
|
|||||||
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.0.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.0.0.tgz",
|
||||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||||
},
|
},
|
||||||
"nan": {
|
|
||||||
"version": "2.14.0",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/nan/-/nan-2.14.0.tgz",
|
|
||||||
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"nice-try": {
|
"nice-try": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://verdaccio.lossless.one/nice-try/-/nice-try-1.0.5.tgz",
|
"resolved": "https://verdaccio.lossless.one/nice-try/-/nice-try-1.0.5.tgz",
|
||||||
@ -1496,12 +1433,6 @@
|
|||||||
"is-number-like": "^1.0.3"
|
"is-number-like": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pretty-bytes": {
|
|
||||||
"version": "4.0.2",
|
|
||||||
"resolved": "https://verdaccio.lossless.one/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
|
|
||||||
"integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"process-nextick-args": {
|
"process-nextick-args": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://verdaccio.lossless.one/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
"resolved": "https://verdaccio.lossless.one/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
@ -1828,6 +1759,7 @@
|
|||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/tiny-worker/-/tiny-worker-2.2.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/tiny-worker/-/tiny-worker-2.2.0.tgz",
|
||||||
"integrity": "sha512-/DnTni0fPjjOlqA6BNcUo6pxyfbViJZ7vxwA+RZ+gF0dBevxp0sropQFVZ4NS5PRgQ8J7EBu8zMJYKwoNo5aWg==",
|
"integrity": "sha512-/DnTni0fPjjOlqA6BNcUo6pxyfbViJZ7vxwA+RZ+gF0dBevxp0sropQFVZ4NS5PRgQ8J7EBu8zMJYKwoNo5aWg==",
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"esm": "^3.2.22"
|
"esm": "^3.2.22"
|
||||||
}
|
}
|
||||||
|
10
package.json
10
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartproxy",
|
"name": "@pushrocks/smartproxy",
|
||||||
"version": "1.0.21",
|
"version": "1.0.24",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a proxy for handling high workloads of proxying",
|
"description": "a proxy for handling high workloads of proxying",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -9,13 +9,13 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)",
|
"build": "(tsbuild --web)",
|
||||||
"format": "(gitzone format)"
|
"format": "(gitzone format)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.0.22",
|
||||||
"@gitzone/tstest": "^1.0.15",
|
"@gitzone/tstest": "^1.0.15",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.13",
|
||||||
"@types/node": "^12.7.2",
|
"@types/node": "^12.7.2",
|
||||||
"tslint": "^5.19.0",
|
"tslint": "^5.19.0",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
@ -24,8 +24,8 @@
|
|||||||
"@pushrocks/smartnetwork": "^1.1.6",
|
"@pushrocks/smartnetwork": "^1.1.6",
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"@pushrocks/smartrequest": "^1.1.23",
|
"@pushrocks/smartrequest": "^1.1.23",
|
||||||
"@pushrocks/smartspawn": "^2.0.8",
|
"@pushrocks/smartspawn": "^2.0.9",
|
||||||
"@pushrocks/smartsystem": "^2.0.7",
|
"@pushrocks/smartsystem": "^2.0.8",
|
||||||
"@tsclass/tsclass": "^2.0.5",
|
"@tsclass/tsclass": "^2.0.5",
|
||||||
"@types/ws": "^6.0.2",
|
"@types/ws": "^6.0.2",
|
||||||
"ws": "^7.1.2"
|
"ws": "^7.1.2"
|
||||||
|
@ -15,7 +15,7 @@ tap.test('should start the testproxy', async () => {
|
|||||||
await testProxy.start();
|
await testProxy.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should wait for 5 seconds', async (tools) => {
|
tap.test('should wait for 5 seconds', async tools => {
|
||||||
await tools.delayFor(1000);
|
await tools.delayFor(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,28 +38,31 @@ export class ProxyWorker {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const Websocket = await import('ws');
|
||||||
|
|
||||||
// Enable websockets
|
// Enable websockets
|
||||||
const wss = new plugins.ws.Server({ server: this.httpsServer });
|
const wss = new plugins.ws.Server({ server: this.httpsServer });
|
||||||
wss.on('connection', function connection(ws) {
|
wss.on('connection', function connection(ws) {
|
||||||
const wscConnected = plugins.smartpromise.defer();
|
const wscConnected = plugins.smartpromise.defer();
|
||||||
const wsc = new plugins.ws(`${ws.url}`);
|
|
||||||
|
const wsc = new Websocket.default(`${ws.url}`);
|
||||||
wsc.on('open', () => {
|
wsc.on('open', () => {
|
||||||
wscConnected.resolve();
|
wscConnected.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.on('message', async (message) => {
|
ws.on('message', async message => {
|
||||||
await wscConnected.promise;
|
await wscConnected.promise;
|
||||||
wsc.emit('message', message);
|
wsc.emit('message', message);
|
||||||
});
|
});
|
||||||
wsc.on('message', (message) => {
|
wsc.on('message', message => {
|
||||||
ws.emit('message', message);
|
ws.emit('message', message);
|
||||||
});
|
});
|
||||||
|
|
||||||
// handle closing
|
// handle closing
|
||||||
ws.on('close', (message) => {
|
ws.on('close', message => {
|
||||||
wsc.close();
|
wsc.close();
|
||||||
});
|
});
|
||||||
wsc.on('close', (message) => {
|
wsc.on('close', message => {
|
||||||
ws.close();
|
ws.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,9 @@ export class SmartProxy {
|
|||||||
public proxyWorkerFunctions: plugins.smartspawn.ModuleThread<TProxyWorkerCalls>;
|
public proxyWorkerFunctions: plugins.smartspawn.ModuleThread<TProxyWorkerCalls>;
|
||||||
public portProxyFunctions: plugins.smartspawn.ModuleThread<TPortProxyCalls>;
|
public portProxyFunctions: plugins.smartspawn.ModuleThread<TPortProxyCalls>;
|
||||||
|
|
||||||
public async updateReversConfigs(reverseConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]) {
|
public async updateReversConfigs(
|
||||||
|
reverseConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]
|
||||||
|
) {
|
||||||
// TODO search for old hostCandidates with that target
|
// TODO search for old hostCandidates with that target
|
||||||
this.reverseConfigs = reverseConfigsArg;
|
this.reverseConfigs = reverseConfigsArg;
|
||||||
if (this.proxyWorkerFunctions) {
|
if (this.proxyWorkerFunctions) {
|
||||||
@ -17,25 +19,27 @@ export class SmartProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async start () {
|
public async start() {
|
||||||
this.proxyWorkerFunctions = await plugins.smartspawn.spawn<TProxyWorkerCalls>(new plugins.smartspawn.Worker('./smartproxy.classes.proxyworker'));
|
this.proxyWorkerFunctions = await plugins.smartspawn.spawn<TProxyWorkerCalls>(
|
||||||
|
new plugins.smartspawn.Worker('./smartproxy.classes.proxyworker')
|
||||||
|
);
|
||||||
this.proxyWorkerFunctions.updateReverseConfigs(this.reverseConfigs);
|
this.proxyWorkerFunctions.updateReverseConfigs(this.reverseConfigs);
|
||||||
|
|
||||||
this.portProxyFunctions = await plugins.smartspawn.spawn<TPortProxyCalls>(new plugins.smartspawn.Worker('./smartproxy.portproxy'));
|
this.portProxyFunctions = await plugins.smartspawn.spawn<TPortProxyCalls>(
|
||||||
|
new plugins.smartspawn.Worker('./smartproxy.portproxy')
|
||||||
|
);
|
||||||
await this.proxyWorkerFunctions.start();
|
await this.proxyWorkerFunctions.start();
|
||||||
|
|
||||||
console.log('successfully spawned portproxy and proxyworkers!');
|
console.log('successfully spawned portproxy and proxyworkers!');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async stop () {
|
public async stop() {
|
||||||
await this.proxyWorkerFunctions.stop();
|
await this.proxyWorkerFunctions.stop();
|
||||||
await plugins.smartspawn.Thread.terminate(this.portProxyFunctions);
|
await plugins.smartspawn.Thread.terminate(this.proxyWorkerFunctions);
|
||||||
console.log('proxy worker stopped');
|
console.log('proxy worker stopped');
|
||||||
await this.portProxyFunctions.stop();
|
await this.portProxyFunctions.stop();
|
||||||
await plugins.smartspawn.Thread.terminate(this.proxyWorkerFunctions);
|
await plugins.smartspawn.Thread.terminate(this.portProxyFunctions);
|
||||||
console.log('portproxy stopped');
|
console.log('portproxy stopped');
|
||||||
console.log('Terminated all childs!');
|
console.log('Terminated all childs!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,7 @@ export { http, https };
|
|||||||
// tsclass scope
|
// tsclass scope
|
||||||
import * as tsclass from '@tsclass/tsclass';
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
|
|
||||||
export {
|
export { tsclass };
|
||||||
tsclass
|
|
||||||
};
|
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
@ -17,16 +15,9 @@ import * as smartrequest from '@pushrocks/smartrequest';
|
|||||||
import * as smartspawn from '@pushrocks/smartspawn';
|
import * as smartspawn from '@pushrocks/smartspawn';
|
||||||
import * as smartsystem from '@pushrocks/smartsystem';
|
import * as smartsystem from '@pushrocks/smartsystem';
|
||||||
|
|
||||||
export {
|
export { smartrequest, smartpromise, smartspawn, smartsystem };
|
||||||
smartrequest,
|
|
||||||
smartpromise,
|
|
||||||
smartspawn,
|
|
||||||
smartsystem,
|
|
||||||
};
|
|
||||||
|
|
||||||
// third party scope
|
// third party scope
|
||||||
import * as ws from 'ws';
|
import * as ws from 'ws';
|
||||||
|
|
||||||
export {
|
export { ws };
|
||||||
ws
|
|
||||||
};
|
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
import * as plugins from './smartproxy.plugins';
|
import * as plugins from './smartproxy.plugins';
|
||||||
import { expose } from '@pushrocks/smartspawn';
|
import { expose } from '@pushrocks/smartspawn';
|
||||||
import * as net from 'net';
|
import * as net from 'net';
|
||||||
const server = net.createServer(from => {
|
const server = net
|
||||||
|
.createServer(from => {
|
||||||
const to = net.createConnection({
|
const to = net.createConnection({
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
port: 8001
|
port: 8001
|
||||||
});
|
});
|
||||||
from.pipe(to);
|
from.pipe(to);
|
||||||
to.pipe(from);
|
to.pipe(from);
|
||||||
}).listen(8000);
|
})
|
||||||
|
.listen(8000);
|
||||||
|
|
||||||
const portProxyCalls = {
|
const portProxyCalls = {
|
||||||
stop: async () => {
|
stop: async () => {
|
||||||
|
Reference in New Issue
Block a user