Skip to content
Make server forwards all data to another. So you can send online traffic to develop env.
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
example
lib
test
.gitignore
.travis.yml
Makefile
README.md
index.js
package.json

README.md

forwards traves-ci

Make server forwards all data to another. So you can send online traffic to develop host.

Usage

You can use the exports function connect

var forwards = require('forwards');

/**
 * exports function connect
 * connect `from` to `to`, forwards all data 
 * @param  {Server,Socket} from    
 * @param  {Array,String} to      
 * @param {Object} options 
 *  - {Number} reconnectTime
 *  - {Number} delay       forwards delay. defalut forwards 10ms latter
 */
forwards.connect(from, to, reconnectTime);
  • Use forwards in net

    var forwards = require('forwards');
    var net = require('net');
    var server = net.createServer();
    server.listen(8080);
    forwards.connect(server, 'localhost:8081');

    or try this style

var forwards = require('forwards');
var net = require('net');
var server = net.createServer();
server.listen(8080);
server.on('connection', function(socket) {
  var f = forwards.connect(socket, 'localhost:8081');
});
  • Use forwards in http
var forwards = require('forwards');
var http = require('http');
server = http.createServer();
server.listen(8080);
forwards.connect(server, 'localhost:8081');
  • Also you can use forwards in connect, express and other every thing base on net

Install

  • Clone from github
  • Use npm

    npm install forwards
    

    License

    MIT

Something went wrong with that request. Please try again.