Node.js 如何使用QuotaGard static设置FTP静态ip?
我使用的是托管在heroku上的nodejs FTP客户端,但我连接的端点需要将我的静态IP列入白名单。Heroku不提供静态IP,所以我使用QuotaGard插件。我对如何使用QuotaGard url代理我的FTP连接有点迷茫Node.js 如何使用QuotaGard static设置FTP静态ip?,node.js,heroku,ftp,static-ip-address,quotaguard,Node.js,Heroku,Ftp,Static Ip Address,Quotaguard,我使用的是托管在heroku上的nodejs FTP客户端,但我连接的端点需要将我的静态IP列入白名单。Heroku不提供静态IP,所以我使用QuotaGard插件。我对如何使用QuotaGard url代理我的FTP连接有点迷茫 谢谢你的帮助 您可以使用fork-of-node ftp包来完成此操作,但它不在NPM中,因此需要手动安装 本地克隆repo:git克隆git@github.com:choonyme/node sockstp.git 将socksftp目录复制到您的项目目录中(例如,
谢谢你的帮助 您可以使用fork-of-node ftp包来完成此操作,但它不在NPM中,因此需要手动安装
git克隆git@github.com:choonyme/node sockstp.git
cp-r节点socksftp/socksftp./node_modules/
var url = require('url');
var Client = require('socksftp');
var httpProxyUrl = process.env.QUOTAGUARDSTATIC_URL;
// Make sure to switch to the SOCKS5 proxy port 1080
var socksProxyUrl = httpProxyUrl.replace(":9293",":1080");
var server = {
'host': 'ftp.linuxjournal.com',
'port': 21,
'socksproxy': socksProxyUrl
};
var c = new Client();
c.on('ready', function() {
c.list(function(err, list) {
if (err) throw err;
console.dir(list);
c.end();
});
});
c.on('error', function(err){
console.error('socksftp error: ' + err);
return;
});
c.connect(server);
作为将来的参考,您可以联系我们的支持团队,我们将更快地作出响应。使用此解决方案获取此错误:错误:套接字已关闭