default.js 723 B

1234567891011121314151617181920212223242526
  1. var tunnel = require('../');
  2. var helper = require('./server');
  3. /**
  4. make sure you can connect to your own machine with the current user without password.
  5. Example: ssh $USER@127.0.0.1
  6. Remember to add your privateKey to your ssh-agent (ssh-add)
  7. **/
  8. var config = {
  9. host: '127.0.0.1', username: process.env.USER, dstPort: 8000, localPort: 7000
  10. };
  11. var fakeServer = helper.createServer(config.dstPort, '127.0.0.1', function () {
  12. tunnel(config, function () {
  13. console.log('Tunnel open');
  14. helper.createClient(7000, '127.0.0.1', console.log);
  15. helper.createClient(7000, '127.0.0.1', console.log);
  16. }).on('error', function (e) {
  17. console.log('error', e);
  18. });
  19. });
  20. fakeServer.unref();