Closed yakov-bakhmatov closed 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
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.
nat
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