sergi/jsftp

proxy doesnt work

holterhoff opened this issue · 1 comments

I've been tryin to connect a ftp Server via Proxy but it does not work.
i tried the example with the "createsocket" but i can not connect to the ftp

I've had same problem.

reproduction;

const JsFtp = require("jsftp");
const {SocksClient} = require('socks');
this.ftp = new JsFtp({
  port: 21,
  user: 'wppsc.html.xdomain.jp',
  password: 'a0120777777',
  host: 'sv2.html.xdomain.ne.jp',
  createSocket: ({port, host}, firstAction) => {
    return SocksClient.createConnection({
      proxy: {
        ipaddress: '140.227.69.235',
        port: 3128,
        type: 5
      },
      command: 'connect',
      destination: {
        host,
        port
      }
    })
  }
});

and logs;

TypeError: this.socket.on is not a function
    at Ftp._createSocket (C:\Users\***\WebstormProjects\***\node_modules\jsftp\lib\jsftp.js:104:15)
    at new Ftp (C:\Users\***\WebstormProjects\ftp_heroku_test\node_modules\jsftp\lib\jsftp.js:71:8)
    at new JsFtpClient (C:\Users\***\WebstormProjects\***\JsFtpClient.js:6:20)
    at Object.<anonymous> (C:\Users\***\WebstormProjects\***\app.js:8:21)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

It's rare that ftp lib with proxy like the jsftp.
I'm long for fix this issue.