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

fix: Passive mode with custom provided TcpStream #91

Closed veeso closed 1 month ago

veeso commented 1 month ago

Hi, i'm trying to connect to a FTP server over a SOCKS5 proxy. Connecting works fine. I just connect with FtpStream::connect_with_stream(stream.into_inner())? where stream is my SOCKS5 TcpStream. The problem is now: In passive mode, when i want to retrieve a file, the connection to the server is not done via the proxy (provided TcpStream). It instantiates a new TcpStream internally. Is there a way to achieve connecting over a custom provided TcpStream when doing retr_as_stream? Best regards, Mark

The implementation consists in being able to provide a Fn to set the TcpStream from the SocketAddr when passive mode is initialized.

veeso commented 1 month ago

@markhaehnel Does it fit your needs?

markhaehnel commented 1 month ago

@markhaehnel Does it fit your needs?

This is exactly what i imagined! Thank you very much!