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 support for UDP forwarding #17

Merged
merged 1 commit into from
Sep 28, 2021

Conversation

chrisroberts
Copy link
Member

Adds support for UDP port forwards in the internal forwarding implementation.

Fixes #11

f.logger.Debug("initializing new connection stream", "fwd", f, "source", conn.RemoteAddr())
go f.stream(conn, target, completed)
go f.stream(target, conn, completed)
if f.Fwd.Host.Type == "" || strings.Contains(f.Fwd.Host.Type, "udp") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if f.Fwd.Host.Type == "" || strings.Contains(f.Fwd.Host.Type, "udp") {
if strings.Contains(f.Fwd.Host.Type, "udp") {

I think this shouldn't have the || bit. From the Vagrant documentation

Either "udp" or "tcp". This specifies the protocol that will be allowed through the forwarded port. By default this is "tcp".

So, if udp is not specified as the type Vagrant should not forward using udp.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 originally when I wrote this it was with the intention of imitating vmware's default behavior (which is just forward everything) but the plugin internally will specify tcp by default when no value is provided and I didn't want to modify that behavior. Will back that bit out 🙂

@chrisroberts chrisroberts merged commit 121c53c into hashicorp:main Sep 28, 2021
@chrisroberts chrisroberts deleted the udp-forward branch September 28, 2021 19:44
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.

Can't forward UDP port with vmware_desktop
2 participants