Skip to content

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

Notifications You must be signed in to change notification settings

pct-tr22/node-tcp-relay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This code started its public life as a post on my blog several years back.

The relayc.js script is meant to be executed on a machine behind a NAT as follows

node relayc.js --sh localserver --sp localport --rh relayserver --rp relayport

Here, localserver is any server visible to the machine behind the NAT, it can also be localhost. localport is the port of the service you want to expose through the relay. relayserver is the host or IP address of the server visible on the internet, and already executing the relays.js script. relayport is the port where this script will connect with the server.

The relay client always maintains one unused connection with the relay server, which the server uses to relay data from the next internet client. As soon as the relay client detects data activity on that connection it establishes another connection.

The relays.js script is meant to be executed on the server visible on the internet as follows

node relays.js --rp relayport --sp serverport

Here, relayport is the port where the server will listen for connections from the relay client. serverport is the port where external clients can connect to the service exposed through the relay.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%