Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-tcp-proxy

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-tcp-proxy - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

2

package.json

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "0.0.12",
"version": "0.0.13",
"main": "index.js",

@@ -8,0 +8,0 @@ "repository": {

@@ -44,1 +44,10 @@ # node-tcp-proxy [![Build Status](https://semaphoreci.com/api/v1/tewarid/node-tcp-proxy/branches/master/badge.svg)](https://semaphoreci.com/tewarid/node-tcp-proxy) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3e3d035c4b78445bbec6fb348cf027e1)](https://www.codacy.com/app/tewarid/node-tcp-proxy?utm_source=github.com&utm_medium=referral&utm_content=tewarid/node-tcp-proxy&utm_campaign=Badge_Grade) [![Maintainability](https://api.codeclimate.com/v1/badges/119038e281e93a7d5d05/maintainability)](https://codeclimate.com/github/tewarid/node-tcp-proxy/maintainability)

`hostname` can be provided through an optional fourth parameter e.g. `{hostname: 0.0.0.0}` to `createProxy`. Console output may be silenced by adding `quiet: true` e.g. `{hostname: 0.0.0.0, quiet: true}`.
If you specify more than one service host and port pair, the proxy will perform round-robin load balancing
```javascript
var hosts = ["host1", "host2"];
var ports = [10080, 10080];
var newProxy = proxy.createProxy(8080, hosts, ports);
// or var newProxy = proxy.createProxy(8080, "host1,host2", "10080,10080");
```

@@ -41,3 +41,4 @@ #!/usr/bin/env node

process.on("uncaughtException", function(err) {
console.error(err);
proxy.end();
});

@@ -44,0 +45,0 @@

@@ -15,6 +15,16 @@ var net = require("net");

function parse(o) {
if (typeof o === "string") {
return o.split(",");
} else if (Array.isArray(o)) {
return o;
} else {
throw new Error("cannot parse object: " + o);
}
}
function TcpProxy(proxyPort, serviceHost, servicePort, options) {
this.proxyPort = proxyPort;
this.serviceHosts = serviceHost.split(",");
this.servicePorts = servicePort.split(",");
this.serviceHosts = parse(serviceHost);
this.servicePorts = parse(servicePort);
this.serviceHostIndex = -1;

@@ -21,0 +31,0 @@ if (options === undefined) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc