fix(tun): drive tun2socks through its YAML config - #217
Merged
Conversation
tun2socks v2.7.0 switched its CLI parsing from stdlib flag to pflag, which rejects the single-dash long flags we passed (-mtu parses as shorthand -m: "unknown shorthand flag: 'm' in -mtu"), so the engine never started. Render a YAML config (accepted by both v2.6.0 and v2.7.0) and launch with --config instead, mirroring the hev path. This also carries the TUN tuning knobs (udp timeout, TCP buffer sizes, log level) that previously reached only hev, and gives tun2socks its own config path on desktop and Android instead of borrowing hev's.
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 v2.6.0 → v2.7.0 tun2socks bump (shipped in v0.4.3) broke the tun2socks TUN engine on desktop and Android: upstream switched CLI parsing from stdlib
flagtospf13/pflag, which rejects the single-dash long flagsspawn_tun2sockspassed —-mtuparses as shorthand-mand the binary exits withunknown shorthand flag: 'm' in -mtu.Instead of just re-dashing the flags, tun2socks is now driven through its YAML config file (
--config, supported by both v2.6.0 and v2.7.0), mirroring the hev path:kasumi_core::tun2socks_config::build_tun2socks_configrenders the config (device,proxy,mtu,loglevel,udp-timeout,tcp-send/receive-buffer-size, optionalfwmark), consuming the sameTunOptionsknobs that already reach hev — previously onlymtuandfwmarkmade it to tun2socks;spawn_tun2sockswrites the config and launches<bin> --config <cfg>;tun2socks.ymlinrun_diron desktop (Linux + Windows),tun2socks.yml/tun2socks2.ymlconsts on Android (the2variant for the force-proxy tun).Wire-format note: upstream's
udp-timeoutis a Gotime.Duration; its YAML parser accepts a duration string (60000ms) but rejects a bare integer, so the generator emits the string form.frontend/src/generated/bindings.tsis codegen output of the updatedAdvancedSettingsdoc comments.Affected layer
frontend/— React Web UIcrates/·src-tauri/— Rust core / backend / Tauri desktopmodule/— Android installable zip (thin launcher over the Rust daemon)scripts/— build / release helpers.github/Verification
Rust (
crates/·src-tauri/):cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace— one failure:net::tests::tcp_ping_fails_on_unreachable_host, the known local-sandbox flake (TEST-NET-1 connect is intercepted by the dev environment;net.rsuntouched)cargo run -p kasumi-desktop --bin codegenleavesgitcleanWeb UI (
frontend/):bun run check— only generatedbindings.tschanged, which Biome ignores by configbun run test— no such script inpackage.jsonbun run build—tsc -b+ vite build succeedbun run check:i18n— no user-visible strings changedAdditionally, against the real release binaries (both the staged v2.6.0 and the downloaded v2.7.0):
Checklist
module/bin/<abi>/,geoip/geosite, builtmodule/webroot/,src-tauri/gen/— all gitignored on purpose)frontend/src/generated/was regenerated from Rust, not hand-editedi18n/en.tsand every locale file updated (no partial translations)kasumi-proxy,Kasumi Proxy, camelCase)Notes for reviewers
Not exercised: live TUN bring-up end-to-end (needs the privileged helper); the config content itself was validated against both real binaries as above.
TunOptionsknobs without a tun2socks equivalent (connect_timeout_ms,tcp_rw_timeout_ms,udp_recv_buffer_size) are intentionally not emitted.