Closed fubar-coder closed 5 years ago
Already done and already part of pull request #50, called "PasvAddress'.
See FtpServerOptions.cs
Yes, you're right. It's the PasvExternalAddress
option. I'll leave this open, because I'd like to change this a little bit to support the special case where a service might have multiple "public" IP addresses (e.g. IPv4, IPv6 and available over multiple network interfaces behind firewalls, etc...)
Hm. How do you propose going about that? Map interface IPs to public IPs?
I'd just pass the local and remote IPs to a service to get the public IP. This should allow a configuration on a per-network-interface basis and should also be able to handle both IPv4 and IPv6.
EDIT: The local IP should be enough to identify the network interface.
You can find my proposed solution in the release/3.0
branch. It's not published yet.
The idea is implemented using an IPasvAddressResolver
service. This service gets the connection and returns PasvListenerOptions
. This allows the specification of a public IP address and IP port range depending on the local IP address (network interface). This also allows us to return an IPv6 address when the user connects via IPv6.
There is a standard implementation called SimplePasvAddressResolver
which can be configured using SimplePasvOptions
.
In case of NAT, the local IP address differs from the public IP address. We must provide a way to make this configurable.