-
Notifications
You must be signed in to change notification settings - Fork 102
Fix and enhance PASV port mapping functionality with comprehensive tests #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…Attempts calculation - Add TestPortMappingRange to test the new PortMappingRange functionality - Add TestPortRangeBackwardCompatibility to ensure backward compatibility - Add getPortFromEPSVResponse helper function for EPSV response parsing - Test both PASV and EPSV commands with port mapping - Fix PortRange.NumberAttempts() to return correct count (End - Start + 1) - Improve test coverage for the new PasvPortGetter interface
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #540 +/- ##
==========================================
+ Coverage 86.68% 86.77% +0.09%
==========================================
Files 11 12 +1
Lines 2328 2344 +16
==========================================
+ Hits 2018 2034 +16
+ Misses 236 235 -1
- Partials 74 75 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Run gofmt and goimports to ensure consistent code formatting - All tests continue to pass - Code compiles successfully
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like
Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
- Add proper comments for exported methods - Fix gosec warnings with nolint directives for acceptable weak random usage - Fix forcetypeassert by using proper type assertion checks - Fix varnamelen issues by using descriptive variable names - Fix nlreturn issues by adding blank lines before returns - Remove unused nolint directives
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ BugBot reviewed your changes and found no bugs!
BugBot free trial expires on June 9, 2025
Your team has used $0.00 of the $50.00 spend limit so far. Team admins can manage spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
Summary
This PR fixes and enhances the PASV port mapping functionality introduced in PR #521, addressing test coverage issues and fixing a bug in the
NumberAttempts()calculation.Changes Made
🐛 Bug Fixes
PortRange.NumberAttempts()calculation: Changed fromr.End - r.Starttor.End - r.Start + 1to correctly include both endpoints in the rangePortRangeandPortMappingRange✅ Test Coverage Improvements
TestPortMappingRange: Comprehensive test for the newPortMappingRangefunctionalityFetchNext()method returns correct exposed and listened portsNumberAttempts()method returns correct countTestPortRangeBackwardCompatibility: Ensures existingPortRangefunctionality continues to workPortRangecorrectly implementsPasvPortGetterinterfacegetPortFromEPSVResponse()helper: Utility function to parse EPSV command responses for testing🔧 Code Quality
PortRangeusage remains unaffectedRelated Issues
This PR addresses the test coverage issues in PR #521 which implements support for passive mode port mapping. The original PR introduced the
PasvPortGetterinterface andPortMappingRangestruct to support Docker deployments where port mapping exists between client and server.Testing
All tests pass, including:
Benefits
PortRangeusage continues to work unchangedBreaking Changes
None. This PR maintains full backward compatibility while adding new functionality.