Skip to content
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

Add remote port parameter to TCP listener factory #104

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

jasongin
Copy link
Member

This addresses a bug in the dev tunnels CLI / SDK: it can print the wrong remote port number for an IPv6 client connection endpoint when the original port number was in use.

> devtunnel connect neat-field-5zxbcmv       
Connected to tunnel: neat-field-5zxbcmv
SSH: Forwarding from 127.0.0.1:9001 to host port 9000.
SSH: Forwarding from [::1]:9001 to host port 9001.

In the example above, the IPv6 port 9001 is actually forwarding to host port 9000, the same as IPv4. The console output there is wrong. (This only happens if port 9000 was in use before the command was run.)

With the remotePort parameter added in this change, the dev tunnels SDK RetryTcpListenerFactory can be updated to use the remotePort instead of localPort in the message "Forwarding from {listener.LocalEndpoint} to host port {localPort}.".

Additionally, this can allow for a future capability for a tunnel client to map host port numbers to different arbitrary client port numbers.

IlyaBiryukov
IlyaBiryukov previously approved these changes Sep 24, 2024
@jasongin jasongin merged commit d138adb into main Sep 25, 2024
1 of 3 checks passed
@jasongin jasongin deleted the dev/jasongin/listener-remote-port branch September 25, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants