veeso / suppaftp

a super FTP/FTPS client library for Rust with support for both passive and active mode
Apache License 2.0
121 stars 31 forks source link

[Feature Request] - support of FTP servers running behind a NAT/proxy #16

Closed yakov-bakhmatov closed 2 years ago

yakov-bakhmatov commented 2 years ago

When an FTP server is running behind a NAT, it returns its private network IP address in response to the PASV command.

In this case, received address should be replaced with the address of the remote peer of the existing connection.

This is implemented, for example, in the Apache Commons Net library: https://github.com/apache/commons-net/blob/b1f6d1af65c67804524a616ce35d8b31f6e750df/src/main/java/org/apache/commons/net/ftp/FTPClient.java#L376

See my patch:

https://github.com/yakov-bakhmatov/suppaftp/tree/pasv-nat

veeso commented 2 years ago

That's great, feel free to open a PR.

Just one thing, I would not use a feature for nat, but a client option instead.