Open hareeqi opened 7 years ago
this should fix the example
var net = require('net');
var TcpProxy = require('tcp-proxy');
var targets = [
{
host: 'localhost',
port: 5050
},
{
host: 'localhost',
port: 5050
}
];
var nextTarget = function () {
var target = targets.shift();
targets.push(target);
return {target:target};
};
var server = net.createServer(function(socket) {
new TcpProxy(socket,nextTarget())
});
server.listen(8000);
I used the package published in NPM and it throws
TypeError: Cannot read property 'target' of undefined
options.target = options.target || this.target;
my code