diff --git a/npmextra.json b/npmextra.json index a1783fa..0e9eea0 100644 --- a/npmextra.json +++ b/npmextra.json @@ -8,14 +8,27 @@ "description": "a proxy for handling high workloads of proxying", "npmPackagename": "@push.rocks/smartproxy", "license": "MIT", - "projectDomain": "push.rocks" + "projectDomain": "push.rocks", + "keywords": [ + "proxy", + "network traffic", + "high workload", + "http", + "https", + "websocket", + "network routing", + "ssl redirect", + "port mapping", + "reverse proxy", + "authentication" + ] } }, "npmci": { "npmGlobalTools": [], "npmAccessLevel": "public" }, - "tsdocs": { + "tsdoc": { "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" } } \ No newline at end of file diff --git a/package.json b/package.json index 92d4d9f..33c80bd 100644 --- a/package.json +++ b/package.json @@ -45,5 +45,18 @@ ], "browserslist": [ "last 1 chrome versions" + ], + "keywords": [ + "proxy", + "network traffic", + "high workload", + "http", + "https", + "websocket", + "network routing", + "ssl redirect", + "port mapping", + "reverse proxy", + "authentication" ] -} +} \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index af75c27..53286ae 100644 --- a/readme.md +++ b/readme.md @@ -1,39 +1,118 @@ # @push.rocks/smartproxy -a proxy for handling high workloads of proxying +A proxy for handling high workloads of proxying. -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartproxy) -* [gitlab.com (source)](https://gitlab.com/push.rocks/smartproxy) -* [github.com (source mirror)](https://github.com/push.rocks/smartproxy) -* [docs (typedoc)](https://push.rocks.gitlab.io/smartproxy/) +## Install +To install `@push.rocks/smartproxy`, run the following command in your project's root directory: -## Status for master +```bash +npm install @push.rocks/smartproxy --save +``` -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartproxy/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartproxy/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartproxy)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartproxy)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartproxy)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartproxy)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartproxy)](https://lossless.cloud) +This will add `@push.rocks/smartproxy` to your project's dependencies. ## Usage -## Contribution +`@push.rocks/smartproxy` is a versatile package for setting up and handling proxies with various capabilities such as SSL redirection, port proxying, and creating network proxies with complex routing rules. Below is a comprehensive guide on using its features. -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). :) +### Setting Up a Network Proxy -## Contribution +Create a network proxy to route incoming HTTPS requests to different local servers based on the hostname. -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). :) +```typescript +import { NetworkProxy } from '@push.rocks/smartproxy'; -For further information read the linked docs at the top of this readme. +// Instantiate the NetworkProxy with desired options +const myNetworkProxy = new NetworkProxy({ port: 443 }); -## Legal -> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +// Define your reverse proxy configurations +const proxyConfigs = [ + { + destinationIp: '127.0.0.1', + destinationPort: '3000', + hostName: 'example.com', + privateKey: `-----BEGIN PRIVATE KEY----- +PRIVATE_KEY_CONTENT +-----END PRIVATE KEY-----`, + publicKey: `-----BEGIN CERTIFICATE----- +CERTIFICATE_CONTENT +-----END CERTIFICATE-----`, + }, + // Add more reverse proxy configurations here +]; + +// Start the network proxy +await myNetworkProxy.start(); + +// Update proxy configurations dynamically +await myNetworkProxy.updateProxyConfigs(proxyConfigs); + +// Optionally, add default headers to all responses +await myNetworkProxy.addDefaultHeaders({ + 'X-Powered-By': 'smartproxy', +}); +``` + +### Port Proxying + +You can also set up a port proxy to forward traffic from one port to another, which is useful for dynamic port forwarding scenarios. + +```typescript +import { PortProxy } from '@push.rocks/smartproxy'; + +// Create a PortProxy to forward traffic from port 5000 to port 3000 +const myPortProxy = new PortProxy(5000, 3000); + +// Start the port proxy +await myPortProxy.start(); + +// To stop the port proxy, simply call +await myPortProxy.stop(); +``` + +### Enabling SSL Redirection + +Easily redirect HTTP traffic to HTTPS using the `SslRedirect` class. This is particularly useful when ensuring all traffic uses encryption. + +```typescript +import { SslRedirect } from '@push.rocks/smartproxy'; + +// Instantiate the SslRedirect on port 80 (HTTP) +const mySslRedirect = new SslRedirect(80); + +// Start listening and redirecting to HTTPS +await mySslRedirect.start(); + +// To stop the redirection, use +await mySslRedirect.stop(); +``` + +### Advanced Usage + +The package integrates seamlessly with TypeScript, allowing for advanced use cases, such as implementing custom routing logic, authentication mechanisms, and handling WebSocket connections through the network proxy. + +For a more advanced setup involving WebSocket proxying and dynamic configuration reloading, refer to the network proxy example provided above. The WebSocket support demonstrates how seamless it is to work with real-time applications. + +Remember, when dealing with certificates and private keys for HTTPS configurations, always secure your keys and store them appropriately. + +`@push.rocks/smartproxy` provides a solid foundation for handling high workloads and complex proxying requirements with ease, whether you're implementing SSL redirections, port forwarding, or extensive routing and WebSocket support in your network. + +For more information on how to use the features, refer to the in-depth documentation available in the package's repository or the npm package description. + +## License and Legal Information + +This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. + +**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file. + +### Trademarks + +This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH. + +### Company Information + +Task Venture Capital GmbH +Registered at District court Bremen HRB 35230 HB, Germany + +For any legal inquiries or if you require further information, please contact us via email at hello@task.vc. + +By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.