Passive URL Resolution #272
Answered
by
antonilol
OneYellowLemon
asked this question in
Q&A
-
Hello! I am trying to have an FTP server work over both local IP and public IP, and I am trying to get the passive URL to work this way. As per the README, this code is provided. const {Netmask} = require('netmask');
const networks = {
'$GATEWAY_IP/32': `${public_ip}`,
'10.0.0.0/8' : `${lan_ip}`
}
const resolverFunction = (address) => {
for (const network in networks) {
try {
const mask = new Netmask(network);
if (mask.contains(address)) return networks[network];
}
catch (err) {
logger.error('Error checking source network', err);
}
}
return '127.0.0.1';
}
new FtpSrv({pasv_url: resolverFunction}); However, I can't figure out how I would make this work without assuming what gateway IP and netmask people will have on their LANs. Is anyone able to help me? |
Beta Was this translation helpful? Give feedback.
Answered by
antonilol
Sep 30, 2021
Replies: 1 comment 4 replies
-
Get the gateway ip address with either a node js library or a system command |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
OneYellowLemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get the gateway ip address with either a node js library or a system command