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

Enable reverse forwarding of portForwards #836

Merged
merged 1 commit into from
May 10, 2022

Conversation

afbjorklund
Copy link
Member

@afbjorklund afbjorklund commented May 1, 2022

By default, the portForwards will be forwarded
from local (host) to remote (guest). Flag: -L

With reverse, the portForwards will be forwarded
from remote (guest) to local (host). Flag: -R

Only implemented for unix sockets at the moment.

I kept the confusing wording, of the logging entries.

Issue #834

Tested by forwarding a memcached socket from the host.

memcached -s mc.sock

portForwards:
 - guestSocket: "/tmp/mc.sock"
   hostSocket: "{{.Home}}/mc.sock"
   reverse: true

lima sudo apt install -y libmemcached-tools
lima MEMCACHED_SERVERS=/tmp/mc.sock memcping


ssh says:

-L local_socket:remote_socket
Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the remote side.
i.e. from host, to guest
-R remote_socket:local_socket
Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded to the local side.
i.e. from guest, to host

lima says:

reverse: false
logrus.Infof("Forwarding %q (guest) to %q (host)", remote, local)
reverse: true
logrus.Infof("Forwarding %q (host) to %q (guest)", local, remote)

AkihiroSuda
AkihiroSuda previously approved these changes May 1, 2022
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda requested a review from jandubois May 1, 2022 18:37
@AkihiroSuda AkihiroSuda added this to the v0.11.0 milestone May 1, 2022
@AkihiroSuda AkihiroSuda added the enhancement New feature or request label May 1, 2022
@jandubois
Copy link
Member

Only implemented for unix sockets at the moment.

I think the "documentation" in default.yaml should mention that this option is only supported for unix sockets, and the code in pkg/limayaml/validate.go should throw an error when it is set for regular TCP ports.

By default, the portForwards will be forwarded
from local (host) to remote (guest). Flag: -L

With reverse, the portForwards will be forwarded
from remote (guest) to local (host). Flag: -R

Only implemented for unix sockets at the moment.

Signed-off-by: Anders F Björklund <[email protected]>
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM, but I only read the code, I didn't actually test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants