giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.66k stars 266 forks source link

First version of Multipath TCP support #588

Closed vanyingenzi closed 10 months ago

vanyingenzi commented 1 year ago

Multipath TCP is a TCP extension defined in RFC8684 that is supported by recent Linux kernels (5.13+). Multipath TCP allows a TCP connection to use different paths (e.g. Wi-Fi and cellular on smartphones, IPv4 and IPv6, ...). Multipath TCP is enabled by default on recent Linux distributions (Debian, Ubuntu, Redhat,...)

This patch creates Multipath TCP sockets by default. If running on a kernel that does not support Multipath TCP, pyftplib remembers the fact that Multipath TCP does not work and does not attempt anymore to use Multipath TCP when creating a TCP connection.

I ran the ioloop tests and they passed. In addition, I'm also developing a Multipath lightweight Python library mftpclient to allow FTP client to benefit from Multipath TCP.

Please feel free to comment, I'm really open for discussion. Another possibility would be to enable Multipath TCP by a command line argument.

giampaolo commented 1 year ago

Hello. Note: it's the first time I hear about this. Question: in order to use this TCP functionality the client must also support it, correct? Does Filezilla client support it? Also, what's the practical advantage? More speed during file transfers?

vanyingenzi commented 1 year ago

Hello,

In order to use this TCP functionality the client must also support it, correct?

Indeed however, in case the client doesn't support it then the connection falls back to a normal TCP connection.

Does Filezilla client support it?

Not that I'm aware of. However, if a FileZilla client tries to connect with the FTP server since the client doesn't support the functionality, the connection continues as a standard TCP connection. I tested this with a FileZilla Client and a digital-ocean server running the pyftplib with the MPTCP extension.

What's the practical advantage?

The main advantages are more bandwidth when the client and server equipped with multiple network interfaces. In addition, more reliability since if a sub-flow fails, then we can use another sub-flow as a back-up.

MPTCP is also supported on macOS and iOS, a famous use-case is the iOS Siri application. Feel free to check the Wikipedia page and Kernel Implementation