Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

prerouting

hex7c029GPL-3.00.5.0

preroute incoming traffic to another TCP server

prerouting, tcp, socks

readme

prerouting

NPM version Linux Status Dependency Status Coveralls

Preroute incoming traffic to N TCP servers; for compress data, encrypt message, etc (or just a loop :D)

      request
         |
         +
 +----------------+
 |  5001 -> 5000  |
 +----------------+
         +
         |
     compression
         |
         +
 +----------------+
 |  5000 -> 3000  |
 +----------------+
         +
         |
    decompression
         |
         +
 +----------------+
 |      3000      |
 +----------------+

Installation

Install through NPM

npm install prerouting

or

git clone git://github.com/hex7c0/prerouting.git

API

inside nodejs project

var prerouting = require('prerouting');

var server = prerouting.createServer();

createServer(options)

options

  • toPort - Number connect to this port (default "3000")
  • toHost- String connect to this host (default "127.0.0.1")
  • listenPort - Number open a TCP server on this port (default "5000")
  • listenHost - String open a TCP server on this host (default "127.0.0.1")
  • dataToNext - Function function to next route (default "false")
  • dataFromNext - Function function from next route (default "false")
  • tls - Object Enable TLS server (default "false")
  • clientUseTls - Boolean connect to TLS client (default "false")

NET options

TLS options

Examples

Take a look at my examples

License GPLv3

changelog

v0.5.0 / 2017-12-30

  • Tested against node@9

v0.4.0 / 2017-02-07

  • Tested against node@7
  • Remove support for node@0

v0.3.1 / 2016-09-12

  • Tested against node@6

v0.3.0 / 2016-08-07

  • Set KeepAlive probe for chaining servers connections
  • Add socketTimeout
  • Add close connection event
  • Handle drain writing, with pause/resume socket

v0.2.0 / 2016-07-02

  • tls options as Boolean
  • Accept net/tls server options (@CreativeCactus)
  • Test node@5

v0.1.2 / 2015-10-16

  • Test node@4

v0.1.1 / 2015-08-16

  • SPDX license

v0.1.0 / 2015-04-03

  • windows test
  • iojs test
  • coveralls test

v0.0.1 / 2015-01-25

  • Project ready

v0.0.0 / 2015-01-24

  • Project start