ftp-proxy

NodeJS ftp proxy prepared for active and passive connections with transfer stats plugin and logging module

npm install ftp-proxy
5 downloads in the last week
17 downloads in the last month

NodeJS FTP Proxy

NodeJS ftp proxy prepared for active and passive connections with transfer stats plugin and logging module.

Stats plugin already has a solution for using rabbitMQ as stats' message publisher.

For more details, go to our Wiki page

$ npm install ftp-proxy

Usage example

(function(){
    var ftpd = require('ftp-proxy');
    var _config = require('./config');
    var _p = {
        'server': null,
        'init': function(){    
            _p.ftpProxy.set();
            return self;
        },
        'ftpProxy': {
            'set': function () {
                var proxy = new ftpd(_config);
                proxy.listen(_config.proxyData.port);
                proxy.on("error", _p.ftpProxy.onError);
            },
            'onError': function(error) {
                console.error(error);
            }
        }
    };
    var self = {};
    return    _p.init();
})();

config.js file example


module.exports = {
    serverData: { 
        host: '127.0.0.1', 
        port: 21 
    },
    proxyData: {
        id: 'Proxy test local machine',
        ip: '127.0.0.1',
        port: 2121,
        machineName: 'Test Machine'
    },
    logging: {
        useConsole: true,
        useFile: true,
        filePath: 'FTPProxy-Logging(%DATE%).log',
        level: 'DEBUG'
    },
    statsPlugin: {
        usePlugin: true,
        activeStatusInterval: 10 * 1000, //10 seconds in milliseconds
        inactiveStatusInterval: 1 * 60 * 60 * 1000, //1 hour in milliseconds
        timeToIgnoreIdleTransfer: 10 * 60 * 1000  //10 minutes in milliseconds
    },
    messagePublisher: {
        connectionString: 'your rabbit connection string',
        exchange: {
            name: 'FtpProxy.Notifications',
            options: {
                type: 'topic'
            }
        },
        RK: {
            snapshot: {
                name : 'FtpProxy.Notifications.Snapshot',
                options:{
                    type: 'FtpProxy.FtpStatus'
                    ,contentType: 'application/json'
                    ,contentEncoding: 'utf-8'
                    ,immediate: true
                }
            },
            onTransferStarted: {
                name : 'FtpProxy.Notifications.OnTransferStarted',
                options:{
                    type: 'FtpProxy.FtpTransferInfo'
                    ,contentType: 'application/json'
                    ,contentEncoding: 'utf-8'
                    ,immediate: true
                }
            },
            onTransferEnded: {
                name : 'FtpProxy.Notifications.OnTransferEnded',
                options:{
                    type: 'FtpProxy.FtpTransferInfo'
                    ,contentType: 'application/json'
                    ,contentEncoding: 'utf-8'
                    ,immediate: true
                }
            },
            onTransferAborted: {
                name : 'FtpProxy.Notifications.OnTransferAborted',
                options:{
                    type: 'FtpProxy.FtpTransferInfo'
                    ,contentType: 'application/json'
                    ,contentEncoding: 'utf-8'
                    ,immediate: true
                }
            }
        }
    }
}
npm loves you