feat(vpn): add Linux support for vpn-daemon and OS networking stack by ibetitsmike · Pull Request #22051 · coder/coder
Navigation Menu
- Notifications You must be signed in to change notification settings
- Fork 1.2k
Conversation
Summary
Adds Linux support for the Desktop VPN daemon by sharing the Windows/Linux CLI implementation and wiring up a Linux networking stack, while removing unsupported-platform stubs. Also hardens the shared daemon tests so in-process runs do not double-close RPC pipe handles.
Changes
- Shared Windows/Linux daemon implementation and tests in OS-agnostic files (
cli/vpndaemon_windows_linux_shared*.go) with//go:build windows || linux. - Added Linux networking stack implementation in
vpn/tun_linux.go(TUN + router + DNS configurator). - Removed unsupported-platform stubs (
cli/vpndaemon_other.go,vpn/tun.go). - Adjusted shared daemon tests to duplicate RPC handles (Linux
unix.Dup, Windowssyscall.DuplicateHandle) before passing them to the in-process daemon to avoid FD/handle reuse issues.
Testing
go test -tags=testsmallbatch ./cli -run 'TestVPNDaemonRun|TestOpenApp' -count=1go test -race -tags=testsmallbatch ./cli -run 'TestVPNDaemonRun|TestOpenApp' -count=1go test -tags=testsmallbatch ./cli -count=1go test -race -tags=testsmallbatch ./cli -count=1make lint
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Addressed Dean's review feedback in 79888291e:
- Shared Windows/Linux daemon implementation in
cli/vpndaemon_windows_linux.gowith//go:build windows || linux. - Shared Windows/Linux tests in
cli/vpndaemon_windows_linux_test.go. - Removed
cli/vpndaemon_linux.go,cli/vpndaemon_linux_test.go, and unsupported-platform stubs (cli/vpndaemon_other.go,vpn/tun.go). - Kept stderr-based logging (no tunnel-pipe logging) and adjusted the handshake test path for race-safety.
Validation run locally:
go test ./cli -run TestVPNDaemonRun -count=1go test -race ./cli -run TestVPNDaemonRun -count=1go test ./vpn -count=1go build ./cli/...go build ./vpn/...make lint/go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters