不用看了,我找到原因了:
虽然 tauri 文档里/源码里没写不支持在 Android 上设置 webview 的 socks5 代理,但向上查找其依赖的 wry 的源码,赫然发现不支持 Android。这下 GG 了 只能用别的方式在 Android 实现透过隧道访问网站的效果了:
- 已知只要把 app 放在前台(不被 freeze, wierd, as putting N4A on the background and the proxy still works),tuic-client 的 socks5 server 是好的,监听在
:4801
- 将 webview 的 url 改成
http(s)://127.0.0.1:4802
( tauri ignore cert error https://192.168.11.149:4843 which is a caddy reverse proxy ) - 弄一个
tokio::net::TcpListener
放:4802
(tcp level, not HTTP level, the same way as when request is HTTP CONNECT ) - 接收到的所有请求都通过 tuic-client 发到
xjtu.app:443
并传递响应
Note: forward HTTP GET has been implemented as of https://github.com/fokx/tauri-app/commit/f3efddfac39a64b06003abe533e20a350add2bfe, works for Discourse on Desktop, not work on Android.
Plan B:
split proxy and webview into two apps
Native Android Webview with socks5 in Kotlin