feat(transfer): add passive port multiplexing by client IP#623
Open
flozano wants to merge 9 commits intofclairamb:mainfrom
Open
feat(transfer): add passive port multiplexing by client IP#623flozano wants to merge 9 commits intofclairamb:mainfrom
flozano wants to merge 9 commits intofclairamb:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #623 +/- ##
==========================================
- Coverage 87.29% 87.22% -0.08%
==========================================
Files 12 13 +1
Lines 1842 2090 +248
==========================================
+ Hits 1608 1823 +215
- Misses 156 180 +24
- Partials 78 87 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Description
This change adds passive port multiplexing so different client IPs can share a narrow passive port range without binding a fresh listener per PASV/EPSV session.
AI disclaimer
This implementation was coded with GPT/Codex assistance.
Why
I am trying to replace AWS Transfer. AWS Transfer's FTP server uses by default a very narrow port range for passive ports (8192-8200). The clients that connect to my server, unfortunately, have hard-coded in their firewalls this port range, and all of them upload at fixed periods (same hour). With current model, only 9 simultaneous passive transfers would be possible. This PR tries to move the limit from 9 simultaneous total to 9 per client IP.
Changes
What changed:
Settings.PassiveTransferPortMultiplexingBehavioral notes:
More on that protocol limit:
PASV/EPSVand before the incoming data connection is matched and the reservation is releasedExamples:
203.0.113.10sendsPASVand gets passive port8192; client B at198.51.100.20also sendsPASVand also gets8192; this works because the accepted data connections arrive from different source IPs and can be demultiplexed safely203.0.113.10sendsPASVand gets8192; before opening the data connection, another control session that is also seen by the server as203.0.113.10sendsPASV; that second session must get another passive port, for example81938192-8200and 10 workers are all behind the same NAT public IP203.0.113.10, then only 9 concurrent pending passive reservations are possible; the 10th cannot be distinguished on the same passive port and must wait or fail with no available passive port203.0.113.10gets8192, opens the data connection, and that reservation is consumed and released, a laterPASVfrom203.0.113.10can reuse8192againOther caveats / issues:
PassiveTransferPortMultiplexingis enabledValidation:
go test ./... -count=1 -timeout 90s