Files
tailscale/net
Nick Khyl 47d3255bd3 net/{batching,sockopts,udprelay},wgengine/magicsock: create batching.Conn early
We used to create a net.UDPConn by calling (*net.ListenConfig).ListenPacket, then conditionally
upgrade it to a batching.Conn on platforms that support it. This works on Linux, where we can
upgrade an existing net.UDPConn to support batching I/O, but it does not work as well on other
platforms where batching may need to be implemented in terms of a platform-specific APIs.

Also, since in practice all nettype.PacketConn implementations were net.UDPConn (at least
temporarily before the upgrade), we used type assertions to *net.UDPConn even when any
syscall.Conn (a type with a SyscallConn method) would work.

In this PR, as preparation for implementing batching.Conn for Windows, we replace those type
assertions with interfaces and add batching.PacketListener. The default implementation creates
a net.UDPConn and tries to upgrade it to a batching.Conn, while allowing platforms to override
ListenPacket as needed.

We then unexport batching.TryUpgradeToConn and replace its usage with batching.PacketListener.

Updates tailscale/corp#36208
2026-01-22 16:14:47 -06:00
..
2025-10-03 19:37:42 -07:00
2024-04-16 15:32:38 -07:00