giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.65k stars 267 forks source link

how do I fill the masquerade_address field? #499

Closed farell closed 5 years ago

farell commented 5 years ago

Specify a masquerade address and the range of ports to use for

passive connections. Decomment in case you're behind a NAT.

handler.masquerade_address = '151.25.42.11'

handler.passive_ports = range(60000, 65535)

Currently I set handler.masquerade_address = '',it worked,but sometimes fail,the error message is " [W 2019-04-19 20:34:43] 192.168.8.4:45431-[user] Rejected data connection from foreign address 192.168.10.65:47558." , how do I set the value of 'handler.masquerade_address' to avoid the above issue? Thanks very much!

tomharvey commented 5 years ago

If you know the public IP of the server you deploy pyftpdlib based app onto them you can hard code it.

I assume you don’t know that tho. In this instance I have a function this_ip() which returns the ip. I need to ping out to a service to ask for the IP, maybe you can use AWS metadata service if your deployed on AWS.

If you add some more context around why you don’t know the address I can help with solutions I find to work.

farell commented 5 years ago

thanks