-
Notifications
You must be signed in to change notification settings - Fork 900
feat: Support for comma-separation and ranges in port-forward #4166
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
Please, also update the docs with all example cases. |
@matifali any thoughts on an example that would be most helpful? Currently we show one and defer to |
How about this?
|
|
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.
Docs LGTM!
type parsedSrcDestPort struct { | ||
local, remote uint16 | ||
} |
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.
Why not just have the function return a portForwardSpec directly? You could pass it a listen and dial network and it would return []portForwardSpec
instead of having an intermediary type
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.
My thinking was probably influenced by the previous implementation, and keeping the type "plain until use". Why plain? For instance, if you see the test where we mangle the portForwardSpec
to make testing more convenient, that's not ideal IMO. In fact I could see parsePortForwards
returning []parsedSrcDestPort
if it was updated with protocol string
field. Then all items could be post-processed into portForwardSpec
as a last step ¯\_(ツ)_/¯
. That code would seem more re-usable if we ever want to parse the port format in other places.
I'm not married to this by any means, I can change it, but I don't see a clear benefit to either way of doing it.
This PR adds support for a more condensed port-forwarding syntax (e.g.
--tcp 8080,9000-9010,9990-9999:10990-10999
).Tests implemented as an internal test since testing the effect (multiple port ranges) isn't feasible externally.
Fixes #3766