npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-tcp-relay

v0.0.18

Published

A simple TCP relay mechanism for NAT traversal built using Node.js

Downloads

15

Readme

node-tcp-relay Build Status Codacy Badge Maintainability

This TCP relay/reverse proxy can be used to expose any TCP/IP service running behind a NAT. This includes services that use HTTP and SSH.

To install from npm

sudo npm install -g node-tcp-relay

Command Line Interface

The relay server is meant to be executed on a server visible on the internet, as follows

tcprelays --relayPort 10080 --servicePort 10081 [--hostname [IP]] [--tls [both]] [--pfx file] [--passphrase passphrase] [--auth] [--caFile file]

relayPort is the port where the relay server will listen for incoming connections from the relay client. servicePort is the port where internet clients can connect to the service exposed through the relay. Optionally, hostname specifies the IP address to listen at. Node.js listens on unspecified IPv6 address :: by default.

tls option enables secure communication with relay client using TLS. If followed by both, TLS is also enabled on the service port. pfx option specifies a private key file used to establish TLS. passphrase specifies password used to protect private key. Relay server authenticates relay client by requesting its certificate when auth option is specified. Use caFile option to specify CA certificates used to validate client certificate.

The relay client is meant to be executed on a machine behind a NAT, as follows

tcprelayc --host host --port 10080 --relayHost host --relayPort port [--numConn count] [--tls [both]] [--rejectUnauthorized] [--caFile file] [--pfx file] [--passphrase value]

host is any server visible to the machine behind the NAT. port is the port of the service you want to expose through the relay.

relayServer is the host name or IP address of the server visible on the internet executing the relay server. relayPort is the relay server port where the client will connect.

numConn is the number of unused connections relay client maintains with the server. As soon as it detects data activity on a socket, it establishes another connection. Servicing internet clients that don't transfer any data may lead to denial of service.

tls enables secure TLS communication with relay server. If followed by both, TLS is also used with server behind the NAT. rejectUnauthorized enables checking for valid server certificate. Custom CA file can be specified using the caFile option. Use pfx option to specify certificate used to authenticate relay client at relay server.

If you're relaying HTTP(S), use a reverse proxy such as http-proxy, between the relay client and the local service e.g.

var httpProxy = require('http-proxy');
httpProxy.createProxyServer({target:'http://host:port'}).listen(port);

Programming Interface

Create and start a relay server thus

var relayServer = require("node-tcp-relay");
var newRelayServer = relayServer.createRelayServer(10080, 10081);

End relay server

newRelayServer.end();

Create and start a relay client thus

var relayClient = require("node-tcp-relay")
var newRelayClient = relayClient.createRelayClient("hostname", 8080, "relayserver", 10080, 1);

End relay client

newRelayClient.end();

Alternatives

  • ssh -R
  • VPN