mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-19 16:30:43 +00:00
ykxmz 1.5.0锛氫慨澶嶆墜琛ㄧ TLS 璇佷功鏍¢獙 + MTU 淇缃戠粶绋冲畾鎬?
琚帶绔?- 淇 MTU 闂锛氬す MSS + 璺緞 MTU 鎺㈡祴锛堝叕缃戝彲鐢ㄧ巼 48% -> 100%锛?- 澶嶇敤 HTTP 杩炴帴锛堝厤鎺夋瘡娆℃柊寤?TLS 鐨?30% 鎻℃墜澶辫触锛?- 姣忓垎閽熷洖澶存壘灞€鍩熺綉锛岃嚜鍔ㄥ垏鍥炲揩 400 鍊嶇殑璺緞 - 鐢婚潰蹇冭烦甯э細闈欐鏃剁渷娴侀噺锛屽鎴风浠嶇煡閬撴祦鏄椿鐨?- 閿佸睆鏃剁粰鍑哄彲鎿嶄綔鐨勬彁绀? 鎵嬭〃绔?- 鍐呯疆 GTS Root R4 / GlobalSign Root CA锛屼慨 SSLHandshakeException - 杩炴帴閿欒缈昏瘧鎴愪汉璇濓紙璇佷功/鏃堕棿/瑙f瀽/瓒呮椂鍒嗗埆鎻愮ず锛?- 缁忎腑杞繛涓婂悗鐢ㄦ湇鍔″櫒鎶ョ殑鍦板潃鍒锋柊宸查厤瀵硅褰?- 鏂板灞€鍩熺綉杩炴帴椤甸潰銆佹湇鍔″櫒寤惰繜妫€娴? 鏈嶅姟鍣ㄧ - 鏀寔 chunked 璇锋眰浣擄紙淇瘡 16 绉掍竴娆$殑杩炴帴閿欎贡涓庡ぇ闈㈢Н 502锛?- 缃戠粶璋冧紭鑴氭湰 net-tune.sh锛堝紑鏈鸿嚜鍔ㄥ簲鐢級 - 绠$悊椤碉細鎵归噺鍒犻櫎銆佺綉缁滀綋妫€銆佷笅杞藉尯 - 闅ч亾鏀?HTTP/2 + 鍙岃繛鎺? 鏂囨。 - 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
# 构建「遥控诊断」APK(aapt2 + javac + d8 + zipalign + apksigner,不需要 Gradle)
|
||||
# 用法: powershell -File diag\build_diag_apk.ps1
|
||||
#
|
||||
# 复用主程序的 Json.java / DiscoveryCore.java(纯 Java,无 Android 依赖),
|
||||
# 这样诊断用的自动发现逻辑和主程序是**同一份代码**,不会出现"诊断能通、
|
||||
# 主程序不通"的假象。
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
$diag = $PSScriptRoot # LanRemote/diag
|
||||
$root = Split-Path -Parent $diag # LanRemote
|
||||
$tc = Join-Path $root "..\starklink\toolchain"
|
||||
$jdk = Join-Path $tc "jdk17"
|
||||
$sdk = Join-Path $tc "android-sdk"
|
||||
$bt = Join-Path $sdk "build-tools\34.0.0"
|
||||
$androidJar = Join-Path $sdk "platforms\android-34\android.jar"
|
||||
$keystore = Join-Path $tc "debug.keystore"
|
||||
|
||||
$javac = Join-Path $jdk "bin\javac.exe"
|
||||
$jar = Join-Path $jdk "bin\jar.exe"
|
||||
$aapt2 = Join-Path $bt "aapt2.exe"
|
||||
$zipalign = Join-Path $bt "zipalign.exe"
|
||||
$apksigner= Join-Path $bt "apksigner.bat"
|
||||
$d8 = Join-Path $bt "d8.bat"
|
||||
|
||||
$work = Join-Path $diag "build"
|
||||
$outDir = Join-Path $root "dist"
|
||||
$apkName = "LanRemote-Diag-1.1.0.apk"
|
||||
|
||||
function Step($text) { Write-Host "`n=== $text ===" -ForegroundColor Cyan }
|
||||
|
||||
foreach ($tool in @($javac, $aapt2, $d8, $zipalign, $apksigner)) {
|
||||
if (-not (Test-Path $tool)) { throw "缺少工具: $tool" }
|
||||
}
|
||||
|
||||
$env:JAVA_HOME = $jdk
|
||||
$env:PATH = "$(Join-Path $jdk 'bin');$env:PATH"
|
||||
|
||||
if (Test-Path $work) { Remove-Item -Recurse -Force $work }
|
||||
New-Item -ItemType Directory -Force -Path $work | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
|
||||
|
||||
Step "1/6 aapt2 compile 资源"
|
||||
$compiled = Join-Path $work "res.zip"
|
||||
& $aapt2 compile --dir (Join-Path $diag "res") -o $compiled
|
||||
if ($LASTEXITCODE -ne 0) { throw "aapt2 compile 失败" }
|
||||
|
||||
Step "2/6 aapt2 link"
|
||||
$genDir = Join-Path $work "gen"
|
||||
New-Item -ItemType Directory -Force -Path $genDir | Out-Null
|
||||
$unsigned = Join-Path $work "app-unsigned.apk"
|
||||
& $aapt2 link `
|
||||
-o $unsigned `
|
||||
-I $androidJar `
|
||||
--manifest (Join-Path $diag "AndroidManifest.xml") `
|
||||
-R $compiled `
|
||||
--java $genDir `
|
||||
--min-sdk-version 24 `
|
||||
--target-sdk-version 34 `
|
||||
--version-code 2 `
|
||||
--version-name "1.1.0" `
|
||||
--auto-add-overlay
|
||||
if ($LASTEXITCODE -ne 0) { throw "aapt2 link 失败" }
|
||||
|
||||
Step "3/6 javac 编译 Java 源码"
|
||||
$classesDir = Join-Path $work "classes"
|
||||
New-Item -ItemType Directory -Force -Path $classesDir | Out-Null
|
||||
|
||||
$javaSources = @()
|
||||
$javaSources += Get-ChildItem -Recurse -Filter *.java -Path (Join-Path $diag "src") |
|
||||
ForEach-Object { $_.FullName }
|
||||
# 复用主程序的纯 Java 代码
|
||||
foreach ($shared in @("Json.java", "B64.java", "DiscoveryCore.java", "Discovery.java")) {
|
||||
$javaSources += (Join-Path $root "android\src\com\lanremote\watch\$shared")
|
||||
}
|
||||
$javaSources += Get-ChildItem -Recurse -Filter R.java -Path $genDir -ErrorAction SilentlyContinue |
|
||||
ForEach-Object { $_.FullName }
|
||||
if ($javaSources.Count -eq 0) { throw "没有找到 Java 源文件" }
|
||||
Write-Host "源文件 $($javaSources.Count) 个"
|
||||
|
||||
& $javac -source 8 -target 8 -nowarn -Xlint:none -encoding UTF-8 `
|
||||
-bootclasspath $androidJar `
|
||||
-d $classesDir `
|
||||
$javaSources 2>&1 | Out-String | Write-Host
|
||||
if ($LASTEXITCODE -ne 0) { throw "javac 编译失败" }
|
||||
|
||||
Step "4/6 d8 转换为 classes.dex"
|
||||
$classesJar = Join-Path $work "classes.jar"
|
||||
& $jar cf $classesJar -C $classesDir .
|
||||
if ($LASTEXITCODE -ne 0) { throw "打包 classes.jar 失败" }
|
||||
|
||||
$dexDir = Join-Path $work "dex"
|
||||
New-Item -ItemType Directory -Force -Path $dexDir | Out-Null
|
||||
& $d8 --lib $androidJar --min-api 24 --output $dexDir $classesJar 2>&1 | Out-String | Write-Host
|
||||
if ($LASTEXITCODE -ne 0) { throw "d8 失败" }
|
||||
$dex = Join-Path $dexDir "classes.dex"
|
||||
Write-Host ("classes.dex 大小 {0:N1} KB" -f ((Get-Item $dex).Length / 1KB))
|
||||
|
||||
Step "5/6 组装 APK"
|
||||
& python (Join-Path $root "_build\pack_apk.py") $unsigned $dex
|
||||
if ($LASTEXITCODE -ne 0) { throw "写入 classes.dex 失败" }
|
||||
|
||||
$aligned = Join-Path $work "app-aligned.apk"
|
||||
& $zipalign -f 4 $unsigned $aligned
|
||||
if ($LASTEXITCODE -ne 0) { throw "zipalign 失败" }
|
||||
|
||||
Step "6/6 apksigner 签名"
|
||||
$final = Join-Path $outDir $apkName
|
||||
if (Test-Path $final) { Remove-Item $final -Force }
|
||||
& $apksigner sign `
|
||||
--ks $keystore `
|
||||
--ks-pass pass:android `
|
||||
--key-pass pass:android `
|
||||
--ks-key-alias androiddebugkey `
|
||||
--v1-signing-enabled true `
|
||||
--v2-signing-enabled true `
|
||||
--out $final `
|
||||
$aligned
|
||||
if ($LASTEXITCODE -ne 0) { throw "签名失败" }
|
||||
|
||||
Step "验证签名"
|
||||
& $apksigner verify --print-certs $final
|
||||
if ($LASTEXITCODE -ne 0) { throw "签名校验失败" }
|
||||
|
||||
Step "构建完成"
|
||||
Write-Host ("APK: {0}" -f $final) -ForegroundColor Green
|
||||
Write-Host ("大小: {0:N2} MB" -f ((Get-Item $final).Length / 1MB)) -ForegroundColor Green
|
||||
Reference in New Issue
Block a user