v0.11.0: Windows support (cfg-gate admin API + rusnel ctl) - #47
Merged
Conversation
The library failed to compile on `x86_64-pc-windows-msvc` because `src/server/admin.rs` and `src/ctl/mod.rs` use `tokio::net::UnixListener`, `UnixStream`, and POSIX `Permissions::set_mode(0o600)` unconditionally. None of these have direct Windows equivalents — Windows has named pipes (different API surface) and ACLs (different model). Rather than block tunnel users on a full named-pipe backend, this PR `#[cfg(unix)]`-gates the admin surface so the rest of rusnel — forward/reverse TCP+UDP, SOCKS5, TLS, embedded credentials, auto-reconnect — compiles and runs on Windows. The admin API + `rusnel ctl` can be added back later without breaking any flags. ### Library - `src/lib.rs`: gate `pub mod ctl;` behind `cfg(unix)`. - `src/server/mod.rs`: gate `pub mod admin;`, the `admin_handle` setup, the spawn helper, the shutdown cleanup, and the `PathBuf` import behind `cfg(unix)`. `ServerConfig.admin_socket` stays declared on every platform so the public API doesn't fork. ### Binary - `Mode::Ctl` and `CtlAction` are `cfg(unix)`. `rusnel --help` on Windows shows the platform-correct command list (no `ctl` subcommand). - `--admin-socket` / `--no-admin-socket` flags are still parsed on Windows so any cross-platform automation that passes them keeps working. If `--admin-socket <PATH>` is set on Windows, rusnel prints a one-line warning to stderr and ignores it. ### Tests + CI - `tests/admin.rs` is `#![cfg(unix)]`-gated. Other integration tests already pass `admin_socket: None` and need no change. - New `windows-latest` job in `ci.yml` runs `cargo build --all` plus `cargo test --lib --bins` on every PR — so future regressions are caught at PR time, not at release time. - `x86_64-pc-windows-msvc` is back in `release.yml`'s prebuilt binary matrix. ### Verified locally - `cargo build` on macOS aarch64 (host) - `cargo check --target x86_64-pc-windows-gnu` (cross) - `cargo clippy --all -- -D warnings` - `cargo test --all` — 150 tests, 0 failures (same count as master). Version 0.10.1 -> 0.11.0 (minor — re-introduces a previously-broken target as a supported one). Co-authored-by: Cursor <cursoragent@cursor.com>
Add `.cargo/config.toml` setting `-C target-feature=+crt-static` for `cfg(target_env = "msvc")`. Without this the released `.exe` depends on `vcruntime140.dll` and friends from the Visual C++ Redistributable, which is not present on a stock Windows install — users hit a "missing DLL" popup the first time they run rusnel. With static CRT linkage the binary is genuinely standalone and matches the single-static-binary promise we make for Linux and macOS. Cost: ~2 MB of extra binary size. Scoped to `target_env = "msvc"` so MSYS2 / GNU Windows targets (`*-windows-gnu`) and every non-Windows target are unaffected. Verified locally: macOS host build and `cargo check --target x86_64-pc-windows-gnu` are both no-op (rustflags don't apply). Co-authored-by: Cursor <cursoragent@cursor.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The library failed to compile on `x86_64-pc-windows-msvc` because `src/server/admin.rs` and `src/ctl/mod.rs` use `tokio::net::UnixListener`, `UnixStream`, and POSIX `Permissions::set_mode(0o600)` unconditionally. None of these have direct Windows equivalents — Windows has named pipes (different API surface) and ACLs (different model).
Rather than block tunnel users on a full named-pipe backend, this PR `#[cfg(unix)]`-gates the admin surface so the rest of rusnel — forward/reverse TCP+UDP, SOCKS5, TLS, embedded credentials, auto-reconnect, all of `stdio:`, `--proxy`, `RUSNEL_EMBED_*` — compiles and runs on Windows. The admin API + `rusnel ctl` can be re-enabled later via a Windows named-pipe backend without changing any flags.
What changed
Library
Binary
Tests + CI
Why `#[cfg(unix)]` instead of named pipes
Two reasons.
Verified locally
Version 0.10.1 → 0.11.0 (minor — re-introduces a previously-broken target as a supported one).
Made with Cursor