Compare commits

...

6 Commits

Author SHA1 Message Date
af42598464 2.0.2 2020-02-23 19:04:53 +00:00
93b1048cb7 fix(core): update 2020-02-23 19:04:53 +00:00
29549b126e 2.0.1 2020-02-23 19:03:26 +00:00
736113eb4e fix(core): update 2020-02-23 19:03:25 +00:00
3b2d140836 2.0.0 2020-02-07 19:36:13 +00:00
70690f6400 BREAKING CHANGE(API): updateReversConfigs -> updateReverseConfigs 2020-02-07 19:36:12 +00:00
6 changed files with 45 additions and 32 deletions

42
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartproxy",
"version": "1.0.38",
"version": "2.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -96,9 +96,9 @@
}
},
"@pushrocks/lik": {
"version": "3.0.16",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.16.tgz",
"integrity": "sha512-rvF4aJL6IRDZXNtSHwnkT+iXUj4peY928g7xpJh8hrFxABMbE89nH/fOBQ0m36IuI5dZBvbZv++2qiFOLsL+oA==",
"version": "3.0.19",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.19.tgz",
"integrity": "sha512-N9uTtQmTJ/iZ/V7LMCKbVx/ZAmP+b8uId0pxV9Au9T0Ulu9wcg3vNpyTQARgdWfG+tI9Qc0NHgOEa9H5mbDcDA==",
"requires": {
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
@ -160,18 +160,12 @@
}
},
"@pushrocks/smartevent": {
"version": "2.0.3",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartevent/-/smartevent-2.0.3.tgz",
"integrity": "sha512-x4B1mzzE6LrMATXsRLNuZpMTlB2JodL44MA4bF4FucU3SBBiWhFv3CFJRlO9B23SKZ1fwdJQrk2lT7YTUHXXJQ==",
"version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartevent/-/smartevent-2.0.5.tgz",
"integrity": "sha512-2cromUAgMFOLxi9IuAhDesWV4FGmsdNQV6k2OQZbH/0bMYeaCT5Q4IcMxb8J5F0S820XCXlwGdy5VP5M6L+hAA==",
"requires": {
"@pushrocks/smartpromise": "^2.0.5"
},
"dependencies": {
"@pushrocks/smartpromise": {
"version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz",
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
}
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5"
}
},
"@pushrocks/smartexit": {
@ -414,9 +408,9 @@
}
},
"@tsclass/tsclass": {
"version": "3.0.3",
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-3.0.3.tgz",
"integrity": "sha512-BsPx1VVyXPMMqfERTMoseRQof8kWZZqeHl74un8Ba0aBxZx4DeEgi6OBR1XroWb4Znv+yOP+QQKOwHAffkKvMQ==",
"version": "3.0.10",
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-3.0.10.tgz",
"integrity": "sha512-8rDOf1aIsG3229Fy4d4xjH00dPX32UrIL7qPvHtuSAkCDsb70k9wJ5Wn+fkHmPoukMsgGIABJjjWjVnLb8yZXw==",
"requires": {
"@pushrocks/tapbundle": "^3.0.13"
}
@ -497,9 +491,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/node": {
"version": "13.7.0",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.0.tgz",
"integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ=="
"version": "13.7.4",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.4.tgz",
"integrity": "sha512-oVeL12C6gQS/GAExndigSaLxTrKpQPxewx9bOcwfvJiJge4rr7wNaph4J+ns5hrmIV2as5qxqN8YKthn9qh0jw=="
},
"@types/portscanner": {
"version": "2.1.0",
@ -1456,9 +1450,9 @@
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
},
"moment-timezone": {
"version": "0.5.27",
"resolved": "https://verdaccio.lossless.one/moment-timezone/-/moment-timezone-0.5.27.tgz",
"integrity": "sha512-EIKQs7h5sAsjhPCqN6ggx6cEbs94GK050254TIJySD1bzoM5JTYDwAU1IoVOeTOL6Gm27kYJ51/uuvq1kIlrbw==",
"version": "0.5.28",
"resolved": "https://verdaccio.lossless.one/moment-timezone/-/moment-timezone-0.5.28.tgz",
"integrity": "sha512-TDJkZvAyKIVWg5EtVqRzU97w0Rb0YVbfpqyjgu6GwXCAohVRqwZjf4fOzDE6p1Ch98Sro/8hQQi65WDXW5STPw==",
"requires": {
"moment": ">= 2.9.0"
}

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartproxy",
"version": "1.0.38",
"version": "2.0.2",
"private": false,
"description": "a proxy for handling high workloads of proxying",
"main": "dist/index.js",
@ -16,19 +16,19 @@
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.2.0",
"@types/node": "^13.7.0",
"@types/node": "^13.7.4",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/lik": "^3.0.16",
"@pushrocks/lik": "^3.0.19",
"@pushrocks/smartnetwork": "^1.1.18",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrequest": "^1.1.47",
"@pushrocks/smartspawn": "^2.0.9",
"@pushrocks/smartstring": "^3.0.18",
"@pushrocks/smartsystem": "^2.0.9",
"@tsclass/tsclass": "^3.0.3",
"@tsclass/tsclass": "^3.0.10",
"@types/ws": "^7.2.1",
"ws": "^7.2.1"
},

View File

@ -18,6 +18,10 @@ a proxy for handling high workloads of proxying
## Usage
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
## Contribution

View File

@ -12,7 +12,7 @@ tap.test('should start the testproxy', async () => {
});
tap.test('should supply reverse proxy config', async () => {
testProxy.updateReversConfigs([
testProxy.updateReverseConfigs([
{
destinationIp: 'localhost',
destinationPort: '3000',

View File

@ -19,7 +19,7 @@ export class SmartProxy {
this.options = optionsArg;
}
public async updateReversConfigs(
public async updateReverseConfigs(
reverseConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]
) {
// TODO search for old hostCandidates with that target

View File

@ -2,9 +2,22 @@ import * as plugins from './smartproxy.plugins';
import { expose } from '@pushrocks/smartspawn';
import * as net from 'net';
let netServer: plugins.net.Server;
let httpServer: plugins.http.Server;
const portProxyCalls = {
start: async (portArg = 8000) => {
httpServer = plugins.http.createServer((request, response) => {
const requestUrl = new URL(request.url, `http://${request.headers.host}`);
const completeUrlWithoutProtocol = `${requestUrl.host}${requestUrl.pathname}${requestUrl.search}`;
const redirectUrl = `https://${completeUrlWithoutProtocol}`;
console.log(`Got http request for http://${completeUrlWithoutProtocol}`);
console.log(`Redirecting to ${redirectUrl}`);
response.writeHead(302, {
Location: redirectUrl
});
response.end();
});
httpServer.listen(7999);
netServer = net
.createServer(from => {
const to = net.createConnection({
@ -19,8 +32,10 @@ const portProxyCalls = {
},
stop: async () => {
const done = plugins.smartpromise.defer();
netServer.close(() => {
done.resolve();
httpServer.close(() => {
netServer.close(() => {
done.resolve();
});
});
await done.promise;
}