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.2 to 0.0.3

2

package.json

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

"license": "MIT",
"version": "0.0.2",
"version": "0.0.3",
"main": "index.js",

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

@@ -11,1 +11,17 @@ A simple TCP proxy that may be used to access a service on another network. An extensible replacement for socat when used thus

```
Install node-tcp-proxy from [npm](https://www.npmjs.com/package/node-tcp-proxy)
```
sudo npm install -g node-tcp-proxy
```
To create a proxy in your own code
```javascript
var proxy = require("node-tcp-proxy");
var newProxy = proxy.createProxy(8080, "hostname", 10080);
```
To end the proxy
```javascript
newProxy.end();
```

@@ -38,12 +38,26 @@ var net = require("net");

}
serviceSocket.on("data", function (data) {
proxySocket.write(data);
});
serviceSocket.on("close", function (had_error) {
console.log("service socket closed");
console.log(" ending proxy socket");
proxySocket.destroy();
});
});
serviceSocket.on("error", function (e) {
console.log("service socket error");
console.log(e);
console.log(" ending proxy socket");
proxySocket.destroy();
});
proxySocket.on("error", function (e) {
serviceSocket.end();
console.log("proxy socket error");
console.log(e);
});
serviceSocket.on("error", function (e) {
console.log("Could not connect to service at host "
+ proxy.serviceHost + ', port ' + proxy.servicePort);
proxySocket.end();
});

@@ -57,13 +71,7 @@ proxySocket.on("data", function (data) {

});
serviceSocket.on("data", function (data) {
proxySocket.write(data);
});
proxySocket.on("close", function (had_error) {
delete proxy.proxySockets[uniqueKey(proxySocket)];
serviceSocket.end();
serviceSocket.destroy();
});
serviceSocket.on("close", function (had_error) {
proxySocket.end();
});

@@ -77,3 +85,3 @@ }).listen(proxy.proxyPort)

for (var key in this.proxySockets) {
this.proxySockets[key].end();
this.proxySockets[key].destroy();
}

@@ -80,0 +88,0 @@ }

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