feat: enable udpgw client via tun2proxy CLI API — no fork needed#270
Closed
yyoyoian-pixel wants to merge 3 commits intotherealaleph:mainfrom
Closed
feat: enable udpgw client via tun2proxy CLI API — no fork needed#270yyoyoian-pixel wants to merge 3 commits intotherealaleph:mainfrom
yyoyoian-pixel wants to merge 3 commits intotherealaleph:mainfrom
Conversation
…, and share sheet - Clipboard paste: banner auto-detects mhrv:// or raw JSON in clipboard, one tap to import. Clipboard cleared after successful import. - Export dialog: QR code + compressed hash + copy button + Android share sheet (sends QR image + text together). - QR scanner: ZXing embedded scanner in portrait orientation. - Deep link: mhrv:// URIs auto-open the app and import the config. - Compact encoding: only non-default fields included, DEFLATE compressed before base64. Accepts both compressed and raw JSON on import. - ConfigStore.loadFromJson() deduplicated — shared by file load + import. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s:// scheme Security fix: deep link (mhrv-rs://) no longer auto-imports config. Stashes decoded config for UI confirmation dialog — same flow as clipboard paste and QR scan. Import confirmation dialog now shows: - Trust warning: "Importing routes your traffic through the deployment IDs in this config. Only import from trusted sources." - Mode and deployment ID count with first 3 IDs previewed - Explicit Import / Cancel buttons Also: - Renamed scheme from mhrv:// to mhrv-rs:// (less collision risk) - Deduplicated import dialog into shared ImportConfirmDialog composable Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Uses tun2proxy_run_with_cli_args (the C API) via dlsym instead of modifying the JNI run() signature. The upstream tun2proxy maintainer recommended this path — the CLI API accepts --udpgw-server natively and offers more flexibility than the JNI entry point. Changes: - Cargo.toml: enable udpgw feature on tun2proxy, remove [patch.crates-io] - MhrvVpnService.kt: build CLI args string with --udpgw-server in full mode - Native.kt + android_jni.rs: Native.runTun2proxy() resolves tun2proxy_run_with_cli_args at runtime via dlsym from libtun2proxy.so - Tun2proxy.kt: reverted to upstream signature (no extra parameter) No fork, no patch, no submodule. Upstream tun2proxy 0.7 with features = ["udpgw"] is all that's needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Superseded by clean branch without config sharing changes |
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
Enables udpgw on Android using upstream tun2proxy's
tun2proxy_run_with_cli_argsC API — no fork, no patch, no submodule.The tun2proxy maintainer recommended this approach over modifying the JNI
run()signature. The CLI API accepts--udpgw-servernatively and offers more flexibility.How it works
MhrvVpnService.ktbuilds a CLI args string:tun2proxy --proxy socks5://... --tun-fd N --udpgw-server 198.18.0.1:7300 ...Native.runTun2proxy()calls the Rust JNI wrapperandroid_jni.rsresolvestun2proxy_run_with_cli_argsat runtime viadlsymfromlibtun2proxy.soTun2proxy.stop()is called (same shutdown path)Why dlsym?
Android's linker namespaces prevent compile-time cross-
.sosymbol resolution.libmhrv_rs.socan't statically link againstlibtun2proxy.sosymbols — the app crashes on library load withUnsatisfiedLinkError. Runtimedlsymavoids this.Changes
Cargo.tomludpgwfeature on tun2proxy, remove[patch.crates-io]MhrvVpnService.kt--udpgw-server 198.18.0.1:7300in full modeNative.ktrunTun2proxy(cliArgs, tunMtu)declarationandroid_jni.rsdlsym-based wrapper callingtun2proxy_run_with_cli_argsTun2proxy.ktCargo.lockTest plan
Tun2proxy.stop()cleanly shuts down🤖 Generated with Claude Code