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

tsnet,wgengine/netstack: add ListenPacket #12184

Merged
merged 1 commit into from
Jun 2, 2024
Merged

tsnet,wgengine/netstack: add ListenPacket #12184

merged 1 commit into from
Jun 2, 2024

Conversation

maisem
Copy link
Collaborator

@maisem maisem commented May 18, 2024

This adds a new ListenPacket function on tsnet.Server
which acts mostly like net.ListenPacket.

Unlike Server.Listen, this requires listening on a
specific IP and does not automatically listen on both
V4 and V6 addresses of the Server when the IP is unspecified.

To test this, it also adds UDP support to tsdial.Dialer.UserDial
and plumbs it through the localapi. Then an associated test
to make sure the UDP functionality works from both sides.

Updates #12182

@maisem maisem force-pushed the maisem/tsnet-udp branch 3 times, most recently from f72de82 to da82771 Compare May 18, 2024 22:01
tsnet/tsnet.go Outdated Show resolved Hide resolved
@willnorris
Copy link
Member

Okay, I got this working:

% /opt/homebrew/opt/curl/bin/curl -i --http3 https://caddytest.tailb575b.ts.net/
HTTP/3 200
date: Tue, 21 May 2024 16:26:26 GMT
content-length: 2
server: Caddy
content-type: text/plain; charset=utf-8

OK

I think the issues I had yesterday were more to do with my browser. Once I got a version of curl compiled with QUIC support, this packet listener seems to work as expected.

@maisem maisem force-pushed the maisem/tsnet-udp branch 2 times, most recently from a7406a6 to d8c0547 Compare June 1, 2024 23:22
@maisem maisem changed the title tsnet,wgengine/netstack: WIP add ListenPacket tsnet,wgengine/netstack: add ListenPacket Jun 1, 2024
@maisem maisem marked this pull request as ready for review June 1, 2024 23:23
Copy link
Member

@bradfitz bradfitz left a comment

Choose a reason for hiding this comment

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

If this works for both of what you two need, SGTM.

client/tailscale/localclient.go Outdated Show resolved Hide resolved
cmd/tailscaled/tailscaled.go Outdated Show resolved Hide resolved
tsnet/tsnet.go Outdated Show resolved Hide resolved
@@ -908,6 +917,34 @@ func (s *Server) Listen(network, addr string) (net.Listener, error) {
return s.listen(network, addr, listenOnTailnet)
}

// ListenPacket announces on the Tailscale network.
Copy link
Member

Choose a reason for hiding this comment

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

TIL that's exactly the wording the net package uses. okay then

tsnet/tsnet.go Outdated Show resolved Hide resolved
wgengine/netstack/netstack.go Show resolved Hide resolved
This adds a new ListenPacket function on tsnet.Server
which acts mostly like `net.ListenPacket`.

Unlike `Server.Listen`, this requires listening on a
specific IP and does not automatically listen on both
V4 and V6 addresses of the Server when the IP is unspecified.

To test this, it also adds UDP support to tsdial.Dialer.UserDial
and plumbs it through the localapi. Then an associated test
to make sure the UDP functionality works from both sides.

Updates #12182

Signed-off-by: Maisem Ali <[email protected]>
@maisem maisem merged commit 42cfbf4 into main Jun 2, 2024
45 of 47 checks passed
@maisem maisem deleted the maisem/tsnet-udp branch June 2, 2024 21:14
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.

None yet

3 participants