We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
var net = require('net'); var TcpProxy = require('tcp-proxy'); var targets = [ { host: 'localhost', port: 5050 }, { host: 'localhost', port: 5050 } ]; var proxies = targets.map(function (target) { return new TcpProxy({ target: target }); }); var nextProxy = function () { var proxy = proxies.shift(); proxies.push(proxy); return proxy; }; var server = net.createServer(function(socket) { nextProxy().proxy(socket); }); server.listen(8000);
The text was updated successfully, but these errors were encountered:
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);
Sorry, something went wrong.
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: