细化+上游代理+1.1

This commit is contained in:
2026-10-25 19:01:45 +08:00
parent 5ec7815a13
commit 070020a296
21 changed files with 1429 additions and 158 deletions
@@ -6,10 +6,11 @@ import android.util.Log
* Rust core_vpn 的 JNI 桥。
*
* 契约(由 Rust lib.rs 实现):
* runCapture(jint tunFd, jstring targetHosts, jstring path, jstring savePath) -> String?
* runCapture(jint tunFd, jstring targetHosts, jstring path, jstring savePath, jstring proxy) -> String?
* - 阻塞直到抓包结束
* - tunFd 的所有权【仍在 Kotlin 侧】,Rust 内部用 BorrowedAsyncDevice 借用,不得 close()
* - targetHosts 是逗号分隔的域名白名单(一个步骤可能对应多个上游域名)
* - proxy 可为 null / 空串(直连),否则必须是 http(s)://host:port 形式,Rust 侧会再校验一次
* - 返回非 null = 抓到目标请求,值是命中的原始完整 URL(https://host/path?query),文件已写入 savePath
* - 返回 null = 失败 / 被 requestStop 打断 / 未匹配
*
@@ -42,7 +43,8 @@ object VpnBridge {
tunFd: Int,
targetHosts: String,
targetPath: String,
savePath: String
savePath: String,
proxy: String?
): String?
@JvmStatic