feat(ftpd): add passive port multiplexing by client IP - #2253
Open
flozano wants to merge 3 commits into
Open
Conversation
Expose the PassiveTransferPortMultiplexing setting added in ftpserverlib v0.31.0 (fclairamb/ftpserverlib#623) through a new "passive_port_multiplexing" FTP option. When enabled, clients with different IP addresses can share the same passive port, increasing the number of concurrent passive transfers that can be served with a limited passive port range. Clients behind the same NAT or public IP are treated as a single client for multiplexing purposes. Signed-off-by: Francisco A. Lozano <flozano@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend TestServerGetSettings to assert that the new PassivePortMultiplexing configuration field is propagated to ftpserver.Settings, mirroring the existing PassiveTransferPortRange assertion. Signed-off-by: Francisco A. Lozano <flozano@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
flozano
force-pushed
the
feat/ftpd-passive-port-multiplexing
branch
from
June 26, 2026 10:13
7913613 to
70b7926
Compare
… a port Add a Linux-only integration test that starts an FTP server with a single-port passive range and PassivePortMultiplexing enabled, then runs several overlapping passive transfers from different loopback source IPs. The transfers are held in-flight at the same time so they genuinely share the one passive port, which is only possible with multiplexing (the test fails by port exhaustion when the flag is off). Each client sends a distinct byte pattern that is read back to verify the server delivered every data connection to the correct session. Signed-off-by: Francisco A. Lozano <flozano@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
flozano
force-pushed
the
feat/ftpd-passive-port-multiplexing
branch
from
June 26, 2026 10:29
70b7926 to
70f879e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ftpserverlib v0.31.0 added passive port multiplexing by client IP via fclairamb/ftpserverlib#623, exposed as the
Settings.PassiveTransferPortMultiplexingflag. SFTPGo already depends on ftpserverlib v0.32.0 but does not surface the option, so this PR wires it through the FTP configuration.When enabled, FTP clients with different IP addresses can share the same passive port concurrently, instead of requiring one listener per session. This increases the number of simultaneous passive transfers that can be served from a limited passive port range. Clients behind the same NAT / public egress IP are treated as a single client for multiplexing purposes, so the effective limit is based on the observed source IP.
The option is disabled by default, preserving the current behavior.
Changes
internal/ftpd/ftpd.go: newPassivePortMultiplexingfield onConfiguration(passive_port_multiplexing), placed next to the existingpassive_port_rangeoption.internal/ftpd/server.go: map it toftpserver.Settings.PassiveTransferPortMultiplexingwhen building the server settings.internal/config/config.go: register the viper default, alongside the otherftpd.*defaults.sftpgo.json: document the new key in the example configuration.The naming mirrors SFTPGo's existing convention, which drops
Transferfrom the upstream names (PassiveTransferPortRange→passive_port_range), giving the parallelpassive_port_multiplexingkey. The exposure follows the exact same pattern as the sibling boolean flags such asdisable_active_mode.Testing
go build ./...go vet ./internal/ftpd/... ./internal/config/...gofmtclean🤖 Generated with Claude Code