realtymaps / promise-ftp

a promise-based ftp client for node.js
MIT License
81 stars 27 forks source link

Is it possible to use this library with a proxy? #39

Open lukewlms opened 5 years ago

lukewlms commented 5 years ago

I need to make an FTP call with a fixed IP, so I'm using Fixie Socks.

I evidently have the proxy socket opening with socksv5, but when trying to access the FTP site I get:

Error: connect ECONNREFUSED 127.0.0.1:21

Here's the code:

        SocksV5.connect(socksV5ConnectArgs, async (socket: any) => {
          try {
            const ftpOptions = {
                secureOptions: { socket },
                user: FTP_USERNAME,
                password: FTP_PASSWORD,
              }

            const promiseFtpClient = new PromiseFtp();

            // Next line fails
            const ftpPromiseResult = await promiseFtpClient.connect(ftpOptions)

            const listResult = promiseFtpClient.list();
            console.log(listResult);
          } catch (err) {
            console.log(err);
          }
        });

I've tried a number of other combinations to try and get this to work, but there's no indication if I am or am not passing the socket correctly along with the username/password combo, and I don't know what exactly is failing because the error message is vague. Is there a way to make this work? Thank you!

chevin99 commented 5 years ago

I was wondering the same thing. Any luck yet @lukewlms ?

lukewlms commented 5 years ago

@chevin99 no :\ have spent some hours on this - it really seems like a scenario no one supports at all unfortunately!

chevin99 commented 5 years ago

@lukewlms dang, well thanks anyway for responding back so quick 😄