Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
af42598464 | |||
93b1048cb7 | |||
29549b126e | |||
736113eb4e |
42
package-lock.json
generated
42
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartproxy",
|
"name": "@pushrocks/smartproxy",
|
||||||
"version": "2.0.0",
|
"version": "2.0.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -96,9 +96,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/lik": {
|
"@pushrocks/lik": {
|
||||||
"version": "3.0.16",
|
"version": "3.0.19",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.16.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.19.tgz",
|
||||||
"integrity": "sha512-rvF4aJL6IRDZXNtSHwnkT+iXUj4peY928g7xpJh8hrFxABMbE89nH/fOBQ0m36IuI5dZBvbZv++2qiFOLsL+oA==",
|
"integrity": "sha512-N9uTtQmTJ/iZ/V7LMCKbVx/ZAmP+b8uId0pxV9Au9T0Ulu9wcg3vNpyTQARgdWfG+tI9Qc0NHgOEa9H5mbDcDA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartdelay": "^2.0.6",
|
"@pushrocks/smartdelay": "^2.0.6",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
@ -160,18 +160,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartevent": {
|
"@pushrocks/smartevent": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.5",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartevent/-/smartevent-2.0.3.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartevent/-/smartevent-2.0.5.tgz",
|
||||||
"integrity": "sha512-x4B1mzzE6LrMATXsRLNuZpMTlB2JodL44MA4bF4FucU3SBBiWhFv3CFJRlO9B23SKZ1fwdJQrk2lT7YTUHXXJQ==",
|
"integrity": "sha512-2cromUAgMFOLxi9IuAhDesWV4FGmsdNQV6k2OQZbH/0bMYeaCT5Q4IcMxb8J5F0S820XCXlwGdy5VP5M6L+hAA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartpromise": "^2.0.5"
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
},
|
"@pushrocks/smartrx": "^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/smartexit": {
|
"@pushrocks/smartexit": {
|
||||||
@ -414,9 +408,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@tsclass/tsclass": {
|
"@tsclass/tsclass": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.10",
|
||||||
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-3.0.3.tgz",
|
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-3.0.10.tgz",
|
||||||
"integrity": "sha512-BsPx1VVyXPMMqfERTMoseRQof8kWZZqeHl74un8Ba0aBxZx4DeEgi6OBR1XroWb4Znv+yOP+QQKOwHAffkKvMQ==",
|
"integrity": "sha512-8rDOf1aIsG3229Fy4d4xjH00dPX32UrIL7qPvHtuSAkCDsb70k9wJ5Wn+fkHmPoukMsgGIABJjjWjVnLb8yZXw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/tapbundle": "^3.0.13"
|
"@pushrocks/tapbundle": "^3.0.13"
|
||||||
}
|
}
|
||||||
@ -497,9 +491,9 @@
|
|||||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "13.7.0",
|
"version": "13.7.4",
|
||||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.4.tgz",
|
||||||
"integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ=="
|
"integrity": "sha512-oVeL12C6gQS/GAExndigSaLxTrKpQPxewx9bOcwfvJiJge4rr7wNaph4J+ns5hrmIV2as5qxqN8YKthn9qh0jw=="
|
||||||
},
|
},
|
||||||
"@types/portscanner": {
|
"@types/portscanner": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
@ -1456,9 +1450,9 @@
|
|||||||
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
|
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
|
||||||
},
|
},
|
||||||
"moment-timezone": {
|
"moment-timezone": {
|
||||||
"version": "0.5.27",
|
"version": "0.5.28",
|
||||||
"resolved": "https://verdaccio.lossless.one/moment-timezone/-/moment-timezone-0.5.27.tgz",
|
"resolved": "https://verdaccio.lossless.one/moment-timezone/-/moment-timezone-0.5.28.tgz",
|
||||||
"integrity": "sha512-EIKQs7h5sAsjhPCqN6ggx6cEbs94GK050254TIJySD1bzoM5JTYDwAU1IoVOeTOL6Gm27kYJ51/uuvq1kIlrbw==",
|
"integrity": "sha512-TDJkZvAyKIVWg5EtVqRzU97w0Rb0YVbfpqyjgu6GwXCAohVRqwZjf4fOzDE6p1Ch98Sro/8hQQi65WDXW5STPw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"moment": ">= 2.9.0"
|
"moment": ">= 2.9.0"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartproxy",
|
"name": "@pushrocks/smartproxy",
|
||||||
"version": "2.0.0",
|
"version": "2.0.2",
|
||||||
"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",
|
||||||
@ -16,19 +16,19 @@
|
|||||||
"@gitzone/tsbuild": "^2.1.17",
|
"@gitzone/tsbuild": "^2.1.17",
|
||||||
"@gitzone/tstest": "^1.0.28",
|
"@gitzone/tstest": "^1.0.28",
|
||||||
"@pushrocks/tapbundle": "^3.2.0",
|
"@pushrocks/tapbundle": "^3.2.0",
|
||||||
"@types/node": "^13.7.0",
|
"@types/node": "^13.7.4",
|
||||||
"tslint": "^6.0.0",
|
"tslint": "^6.0.0",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^3.0.16",
|
"@pushrocks/lik": "^3.0.19",
|
||||||
"@pushrocks/smartnetwork": "^1.1.18",
|
"@pushrocks/smartnetwork": "^1.1.18",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
"@pushrocks/smartrequest": "^1.1.47",
|
"@pushrocks/smartrequest": "^1.1.47",
|
||||||
"@pushrocks/smartspawn": "^2.0.9",
|
"@pushrocks/smartspawn": "^2.0.9",
|
||||||
"@pushrocks/smartstring": "^3.0.18",
|
"@pushrocks/smartstring": "^3.0.18",
|
||||||
"@pushrocks/smartsystem": "^2.0.9",
|
"@pushrocks/smartsystem": "^2.0.9",
|
||||||
"@tsclass/tsclass": "^3.0.3",
|
"@tsclass/tsclass": "^3.0.10",
|
||||||
"@types/ws": "^7.2.1",
|
"@types/ws": "^7.2.1",
|
||||||
"ws": "^7.2.1"
|
"ws": "^7.2.1"
|
||||||
},
|
},
|
||||||
|
@ -18,6 +18,10 @@ a proxy for handling high workloads of proxying
|
|||||||
|
|
||||||
## Usage
|
## 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
|
## Contribution
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ tap.test('should start the testproxy', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should supply reverse proxy config', async () => {
|
tap.test('should supply reverse proxy config', async () => {
|
||||||
testProxy.updateReversConfigs([
|
testProxy.updateReverseConfigs([
|
||||||
{
|
{
|
||||||
destinationIp: 'localhost',
|
destinationIp: 'localhost',
|
||||||
destinationPort: '3000',
|
destinationPort: '3000',
|
||||||
|
@ -2,9 +2,22 @@ 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';
|
||||||
let netServer: plugins.net.Server;
|
let netServer: plugins.net.Server;
|
||||||
|
let httpServer: plugins.http.Server;
|
||||||
|
|
||||||
const portProxyCalls = {
|
const portProxyCalls = {
|
||||||
start: async (portArg = 8000) => {
|
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
|
netServer = net
|
||||||
.createServer(from => {
|
.createServer(from => {
|
||||||
const to = net.createConnection({
|
const to = net.createConnection({
|
||||||
@ -19,8 +32,10 @@ const portProxyCalls = {
|
|||||||
},
|
},
|
||||||
stop: async () => {
|
stop: async () => {
|
||||||
const done = plugins.smartpromise.defer();
|
const done = plugins.smartpromise.defer();
|
||||||
netServer.close(() => {
|
httpServer.close(() => {
|
||||||
done.resolve();
|
netServer.close(() => {
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
await done.promise;
|
await done.promise;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user