543 lines
24 KiB
JavaScript
543 lines
24 KiB
JavaScript
/**
|
||
* LD FDPI — real end-to-end verification suite.
|
||
*
|
||
* Unlike the previous suite (which asserted that fabricated flags and simulation
|
||
* branches existed), every check here validates behaviour that actually ships:
|
||
* the official binary hash, the real SpoofDPI 0.12.2 argv, the absence of mock
|
||
* fallbacks, and a live TLS handshake through the spawned proxy.
|
||
*
|
||
* Run with: npm test
|
||
*/
|
||
import assert from "node:assert/strict";
|
||
import crypto from "node:crypto";
|
||
import { spawn } from "node:child_process";
|
||
import fs from "node:fs";
|
||
import net from "node:net";
|
||
import path from "node:path";
|
||
import { fileURLToPath } from "node:url";
|
||
|
||
import {
|
||
SPOOFDPI_VERSION,
|
||
DOH_PROVIDERS,
|
||
buildSpoofDpiArgs,
|
||
generatePacScript,
|
||
getDohIpv4,
|
||
windowSizeFor,
|
||
} from "../src/utils/engineArgs.js";
|
||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||
const ROOT = path.resolve(__dirname, "..");
|
||
const BIN_DIR = path.join(ROOT, "src-tauri", "binaries");
|
||
const SIDECAR = path.join(BIN_DIR, "spoofdpi-x86_64-pc-windows-gnu.exe");
|
||
const SIDECAR_SHA256 =
|
||
"16a5c81265d908d31aaf9be69d577ec91588282ae5c366cc73e8bff878a3ea5e";
|
||
|
||
let passed = 0;
|
||
let failed = 0;
|
||
|
||
async function runTest(name, fn) {
|
||
try {
|
||
await fn();
|
||
console.log(`PASS ${name}`);
|
||
passed++;
|
||
} catch (error) {
|
||
console.error(`FAIL ${name}\n ${error.message}`);
|
||
failed++;
|
||
}
|
||
}
|
||
|
||
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), "utf8");
|
||
const sha256 = (file) =>
|
||
crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
|
||
|
||
function freePort() {
|
||
return new Promise((resolve, reject) => {
|
||
const server = net.createServer();
|
||
server.unref();
|
||
server.on("error", reject);
|
||
server.listen(0, "127.0.0.1", () => {
|
||
const { port } = server.address();
|
||
server.close(() => resolve(port));
|
||
});
|
||
});
|
||
}
|
||
|
||
function waitForPort(port, timeoutMs = 8000) {
|
||
const deadline = Date.now() + timeoutMs;
|
||
return new Promise((resolve, reject) => {
|
||
const attempt = () => {
|
||
const socket = net.connect({ host: "127.0.0.1", port });
|
||
socket.setTimeout(400);
|
||
socket.once("connect", () => {
|
||
socket.destroy();
|
||
resolve();
|
||
});
|
||
socket.once("timeout", () => {
|
||
socket.destroy();
|
||
retry();
|
||
});
|
||
socket.once("error", () => {
|
||
socket.destroy();
|
||
retry();
|
||
});
|
||
};
|
||
const retry = () => {
|
||
if (Date.now() > deadline) reject(new Error(`${port} dinlenmeye başlamadı`));
|
||
else setTimeout(attempt, 120);
|
||
};
|
||
attempt();
|
||
});
|
||
}
|
||
|
||
import tls from "node:tls";
|
||
|
||
/** CONNECT + full TLS handshake (certificate validated) through the local proxy. */
|
||
function probeThroughProxy(port, host = "discord.com", timeoutMs = 10000) {
|
||
return new Promise((resolve) => {
|
||
const socket = net.connect({ host: "127.0.0.1", port });
|
||
let settled = false;
|
||
const finish = (result) => {
|
||
if (settled) return;
|
||
settled = true;
|
||
try {
|
||
socket.destroy();
|
||
} catch {
|
||
/* ignore */
|
||
}
|
||
resolve(result);
|
||
};
|
||
|
||
socket.setTimeout(timeoutMs, () =>
|
||
finish({ connect: false, tls: false, detail: "timeout" })
|
||
);
|
||
socket.once("error", (error) =>
|
||
finish({ connect: false, tls: false, detail: error.code || error.message })
|
||
);
|
||
socket.once("connect", () =>
|
||
socket.write(`CONNECT ${host}:443 HTTP/1.1\r\nHost: ${host}:443\r\n\r\n`, "ascii")
|
||
);
|
||
|
||
let head = Buffer.alloc(0);
|
||
const onData = (chunk) => {
|
||
head = Buffer.concat([head, chunk]);
|
||
const end = head.indexOf("\r\n\r\n");
|
||
if (end === -1) return;
|
||
socket.removeListener("data", onData);
|
||
const status = head.subarray(0, end).toString("ascii").split("\r\n")[0];
|
||
if (!status.includes("200")) {
|
||
finish({ connect: false, tls: false, detail: status });
|
||
return;
|
||
}
|
||
|
||
const leftover = head.subarray(end + 4);
|
||
socket.pause();
|
||
if (leftover.length > 0) socket.unshift(leftover);
|
||
|
||
const tlsSocket = tls.connect(
|
||
{ socket, servername: host, rejectUnauthorized: true },
|
||
() => {
|
||
tlsSocket.write(
|
||
`HEAD / HTTP/1.1\r\nHost: ${host}\r\nConnection: close\r\n\r\n`
|
||
);
|
||
tlsSocket.once("data", (response) => {
|
||
const line = response.toString("ascii").split("\r\n")[0];
|
||
finish({
|
||
connect: true,
|
||
tls: line.startsWith("HTTP/"),
|
||
detail: `TLS ${tlsSocket.getProtocol()} — ${line}`,
|
||
});
|
||
});
|
||
}
|
||
);
|
||
tlsSocket.once("error", (error) =>
|
||
finish({ connect: true, tls: false, detail: `TLS: ${error.message}` })
|
||
);
|
||
tlsSocket.setTimeout(timeoutMs, () =>
|
||
finish({ connect: true, tls: false, detail: "TLS timeout" })
|
||
);
|
||
};
|
||
socket.on("data", onData);
|
||
});
|
||
}
|
||
|
||
console.log("==============================================================");
|
||
console.log("LD FDPI — gerçek uçtan uca doğrulama (SpoofDPI " + SPOOFDPI_VERSION + ")");
|
||
console.log("==============================================================\n");
|
||
|
||
await runTest("1. Sidecar gerçek SpoofDPI ikilisi (boyut + PE + SHA-256 + sürüm)", async () => {
|
||
assert.ok(fs.existsSync(SIDECAR), `Eksik: ${SIDECAR}`);
|
||
const stat = fs.statSync(SIDECAR);
|
||
assert.ok(stat.size > 1_500_000, `Sahte/eksik ikili: ${stat.size} bayt`);
|
||
const header = fs.readFileSync(SIDECAR).subarray(0, 2).toString("latin1");
|
||
assert.equal(header, "MZ", "PE başlığı yok");
|
||
assert.equal(sha256(SIDECAR), SIDECAR_SHA256, "Resmi sürümle SHA-256 uyuşmuyor");
|
||
const { spawnSync } = await import("node:child_process");
|
||
const run = spawnSync(SIDECAR, ["-v"], { encoding: "utf8", windowsHide: true });
|
||
const out = `${run.stdout || ""}${run.stderr || ""}`;
|
||
assert.ok(out.includes(`spoofdpi v${SPOOFDPI_VERSION}`), `Beklenmeyen sürüm: ${out}`);
|
||
});
|
||
|
||
await runTest("2. CLI argümanları gerçek SpoofDPI 0.12.2 bayraklarıyla uyumlu", async () => {
|
||
const rust = read("src-tauri/src/engine.rs");
|
||
assert.ok(rust.includes('"-listen-addr"'), "Rust -listen-addr göndermiyor");
|
||
assert.ok(rust.includes('"-listen-port"'), "Rust -listen-port göndermiyor");
|
||
assert.ok(rust.includes('"-system-proxy=false"'), "SpoofDPI kendi system proxy'sini yönetmemeli");
|
||
assert.ok(rust.includes('"-enable-doh"'), "DoH kapalı");
|
||
assert.ok(!rust.includes('"-addr"'), "Var olmayan -addr bayrağı hâlâ kodda");
|
||
assert.ok(!rust.includes('"-port"'), "Var olmayan -port bayrağı hâlâ kodda");
|
||
assert.ok(!rust.includes("--mode"), "Uydurma --mode bayrağı");
|
||
assert.ok(!rust.includes("--chunk-size"), "Uydurma --chunk-size bayrağı");
|
||
assert.ok(!rust.includes("--disorder"), "Uydurma --disorder bayrağı");
|
||
|
||
const args = buildSpoofDpiArgs({ proxyPort: 8080, bypassMode: 1, chunkSize: 8, dohProvider: "cloudflare" });
|
||
assert.deepEqual(args, [
|
||
"-listen-addr", "127.0.0.1",
|
||
"-listen-port", "8080",
|
||
"-dns-addr", "1.1.1.1",
|
||
"-enable-doh",
|
||
"-system-proxy=false",
|
||
"-window-size", "8",
|
||
"-timeout", "8000",
|
||
"-silent",
|
||
]);
|
||
assert.equal(windowSizeFor({ bypassMode: 0 }), 1);
|
||
assert.equal(windowSizeFor({ bypassMode: 1, chunkSize: 16 }), 16);
|
||
assert.equal(windowSizeFor({ bypassMode: 2, chunkSize: 16 }), 2);
|
||
});
|
||
|
||
await runTest("3. DoH sağlayıcıları yalnızca IP sertifikası geçerli olanlar", async () => {
|
||
assert.deepEqual(DOH_PROVIDERS.map((p) => p.id), ["cloudflare", "google", "adguard"]);
|
||
assert.equal(getDohIpv4("google"), "8.8.8.8");
|
||
assert.equal(getDohIpv4("adguard"), "94.140.14.14");
|
||
assert.equal(getDohIpv4("quad9"), "1.1.1.1", "Desteklenmeyen sağlayıcı güvenli varsayılana düşmeli");
|
||
const i18n = read("src/i18n.js");
|
||
assert.ok(!i18n.includes("quad9"), "Kaldırılan Quad9 seçeneği arayüzde duruyor");
|
||
});
|
||
|
||
await runTest("4. Tauri v2 yapılandırması: externalBin, CSP/IPC, shell yetkisi yok", async () => {
|
||
const conf = JSON.parse(read("src-tauri/tauri.conf.json"));
|
||
assert.deepEqual(conf.bundle.externalBin, ["binaries/spoofdpi"]);
|
||
assert.ok(conf.app.security.csp.includes("ipc:"), "CSP ipc: şemasına izin vermiyor");
|
||
assert.ok(
|
||
conf.app.security.csp.includes("http://ipc.localhost"),
|
||
"CSP http://ipc.localhost adresine izin vermiyor"
|
||
);
|
||
const cap = JSON.parse(read("src-tauri/capabilities/default.json"));
|
||
const flat = JSON.stringify(cap.permissions);
|
||
assert.ok(!flat.includes("shell:"), "Webview'e shell yetkisi verilmiş");
|
||
assert.ok(cap.windows.includes("main"), "Capability ana pencereye bağlı değil");
|
||
});
|
||
|
||
await runTest("5. Frontend sahte/simülasyon modu içermiyor", async () => {
|
||
const bridge = read("src/utils/tauriBridge.js");
|
||
const args = read("src/utils/engineArgs.js");
|
||
assert.ok(args.includes("window.__TAURI_INTERNALS__"), "Tauri tespiti yok");
|
||
assert.ok(bridge.includes("isTauriRuntime"), "Köprü Tauri tespitini kullanmıyor");
|
||
assert.ok(!bridge.includes("simulate"), "Simülasyon kodu hâlâ mevcut");
|
||
assert.ok(!bridge.includes("setTimeout"), "Gecikmeli sahte yanıt üretimi mevcut");
|
||
assert.ok(bridge.includes("Tauri v2 çalışma zamanı bulunamadı"), "Tauri dışında sessiz kalmamalı");
|
||
const app = read("src/App.jsx");
|
||
assert.ok(!app.includes("simulateWintunMissing"), "Wintun simülasyonu hâlâ UI'da");
|
||
const appVersion = JSON.parse(read("package.json")).version;
|
||
assert.ok(
|
||
app.includes(`useState("${appVersion}")`),
|
||
`UI sürümü package.json (${appVersion}) ile uyuşmuyor`
|
||
);
|
||
});
|
||
|
||
await runTest("6. PAC betiği Rust ve JS tarafında birebir aynı kuralları kullanıyor", async () => {
|
||
const rust = read("src-tauri/src/pac_server.rs");
|
||
const js = generatePacScript("192.168.1.42", 8080);
|
||
for (const token of [
|
||
"FindProxyForURL",
|
||
"a === 127",
|
||
"a === 10",
|
||
"a === 192",
|
||
"a === 172",
|
||
"*.edu",
|
||
"eduroam.org",
|
||
"DIRECT",
|
||
"PROXY",
|
||
]) {
|
||
assert.ok(rust.includes(token), `Rust PAC'inde eksik: ${token}`);
|
||
assert.ok(js.includes(token), `JS PAC'inde eksik: ${token}`);
|
||
}
|
||
assert.ok(js.includes("PROXY 192.168.1.42:8080; DIRECT"));
|
||
assert.ok(rust.includes("PROXY {local_ip}:{proxy_port}; DIRECT"));
|
||
});
|
||
|
||
await runTest("7. Sentinel: yedek yoksa kayıt defterine dokunmuyor", async () => {
|
||
const rust = read("src-tauri/src/proxy_sentinel.rs");
|
||
assert.ok(rust.includes("InternetSetOptionW"), "WinInet bildirimi yok");
|
||
assert.ok(rust.includes("INTERNET_OPTION_SETTINGS_CHANGED"));
|
||
assert.ok(rust.includes("INTERNET_OPTION_REFRESH"));
|
||
assert.ok(rust.includes("noBackup"), "Yedek yoksa no-op koruması yok");
|
||
assert.ok(!rust.includes("ProxyBackupSnapshot"), "Eski varsayılan-yedek (yıkıcı) tipi kaldı");
|
||
assert.ok(rust.includes('delete_value("AutoConfigURL")'), "PAC bağlantısı temizlenmiyor");
|
||
assert.ok(rust.includes("dirty_sentinel"), "Kirli oturum bayrağı yok");
|
||
});
|
||
|
||
await runTest("8. Engelleyici süreç yok + canlı proxy üzerinden TLS el sıkışması", async () => {
|
||
const port = await freePort();
|
||
const args = buildSpoofDpiArgs({
|
||
proxyPort: port,
|
||
bypassMode: 1,
|
||
chunkSize: 8,
|
||
dohProvider: "cloudflare",
|
||
lanSharing: false,
|
||
});
|
||
const logPath = path.join(ROOT, "src-tauri", "binaries", "verify-engine.log");
|
||
const logFd = fs.openSync(logPath, "w");
|
||
const child = spawn(SIDECAR, args, {
|
||
windowsHide: true,
|
||
stdio: ["ignore", logFd, logFd],
|
||
});
|
||
|
||
try {
|
||
await waitForPort(port);
|
||
const discord = await probeThroughProxy(port, "discord.com");
|
||
assert.ok(discord.connect, `CONNECT başarısız: ${discord.detail}`);
|
||
assert.ok(discord.tls, `TLS yanıtı yok: ${discord.detail}`);
|
||
|
||
const control = await probeThroughProxy(port, "www.cloudflare.com");
|
||
assert.ok(control.tls, `Kontrol sitesi TLS başarısız: ${control.detail}`);
|
||
} finally {
|
||
child.kill();
|
||
await new Promise((resolve) => {
|
||
if (child.exitCode !== null) resolve();
|
||
else child.once("exit", resolve);
|
||
setTimeout(resolve, 2000);
|
||
});
|
||
fs.closeSync(logFd);
|
||
}
|
||
});
|
||
|
||
await runTest("9. TR/EN sözlük anahtarları eşleşiyor", async () => {
|
||
const { TEXT } = await import("../src/i18n.js");
|
||
assert.deepEqual(Object.keys(TEXT.tr), Object.keys(TEXT.en));
|
||
for (const section of ["nav", "status", "actions", "mode", "power", "settings", "advanced", "logs"]) {
|
||
assert.deepEqual(
|
||
Object.keys(TEXT.tr[section]),
|
||
Object.keys(TEXT.en[section]),
|
||
`${section} anahtarları eşleşmiyor`
|
||
);
|
||
}
|
||
});
|
||
|
||
await runTest("10. package.json scriptleri doğru", async () => {
|
||
const pkg = JSON.parse(read("package.json"));
|
||
assert.ok(pkg.scripts["setup:sidecar"].includes("download-sidecar"));
|
||
assert.ok(pkg.scripts.test.includes("verify-all"));
|
||
assert.ok(pkg.scripts["test:gui"].includes("e2e-gui"));
|
||
assert.ok(!pkg.dependencies["@tauri-apps/plugin-shell"], "Kullanılmayan shell eklentisi kaldırılmalı");
|
||
assert.ok(
|
||
!pkg.dependencies["@tauri-apps/plugin-autostart"],
|
||
"Autostart artık Görev Zamanlayıcı ile Rust'ta yönetiliyor"
|
||
);
|
||
});
|
||
|
||
await runTest("11. Manuel başlangıç: varsayılanlar ve config.json kalıcılığı", async () => {
|
||
const configRs = read("src-tauri/src/config.rs");
|
||
assert.ok(configRs.includes("auto_start: true"), "auto_start varsayılanı açık olmalı");
|
||
assert.ok(configRs.includes("auto_connect: false"), "auto_connect varsayılanı kapalı olmalı (manuel mod)");
|
||
assert.ok(configRs.includes("minimize_to_tray: true"), "minimize_to_tray varsayılanı açık olmalı");
|
||
assert.ok(configRs.includes("config.json"), "config.json yolu tanımlı olmalı");
|
||
assert.ok(configRs.includes("pub fn save"), "config kaydetme fonksiyonu yok");
|
||
});
|
||
|
||
await runTest("12. Yönetici UAC manifestosu + RL HIGHEST Görev Zamanlayıcı", async () => {
|
||
const manifest = read("src-tauri/windows-app-manifest.xml");
|
||
assert.ok(manifest.includes('level="requireAdministrator"'), "UAC requireAdministrator yok");
|
||
const build = read("src-tauri/build.rs");
|
||
assert.ok(build.includes("app_manifest"), "build.rs özel manifesti gömmüyor");
|
||
assert.ok(build.includes("LD_FDPI_NO_ADMIN"), "Test için asInvoker anahtarı yok");
|
||
const auto = read("src-tauri/src/autostart.rs");
|
||
assert.ok(auto.includes('"HIGHEST"'), "RL HIGHEST eksik");
|
||
assert.ok(auto.includes('"ONLOGON"'), "ONLOGON tetikleyicisi eksik");
|
||
assert.ok(auto.includes("schtasks"), "schtasks kullanılmıyor");
|
||
assert.ok(auto.includes("--minimized"), "--minimized argümanı görevde yok");
|
||
const conf = JSON.parse(read("src-tauri/tauri.conf.json"));
|
||
assert.equal(conf.app.windows[0].visible, false, "Pencere gizli başlamalı (sessiz tray)");
|
||
});
|
||
|
||
await runTest("13. Otomatik bağlantı + 15 sn kendi kendini onarma döngüsü", async () => {
|
||
const lib = read("src-tauri/src/lib.rs");
|
||
assert.ok(lib.includes("auto_connect"), "auto_connect okunmuyor");
|
||
assert.ok(lib.includes("start_supervisor"), "supervisor başlatılmıyor");
|
||
assert.ok(lib.includes("Duration::from_secs(15)"), "15 saniyelik sağlık kontrolü yok");
|
||
assert.ok(lib.includes("woke"), "uyku sonrası uyanma tespiti yok");
|
||
assert.ok(lib.includes("get_status"), "hafif durum komutu yok");
|
||
const app = read("src/App.jsx");
|
||
assert.ok(app.includes("get_status"), "arayüz durum yoklaması yapmıyor");
|
||
assert.ok(app.includes("save_config"), "arayüz ayarları kaydetmiyor");
|
||
assert.ok(!app.includes("ClientHello"), "teknik paket şeması ana ekranda kalmış");
|
||
});
|
||
|
||
await runTest("14. Sidecar SHA-256 pin + shell/unsafe çağrı yok", async () => {
|
||
const engine = read("src-tauri/src/engine.rs");
|
||
assert.ok(engine.includes("SIDECAR_SHA256"), "SHA-256 pin sabiti yok");
|
||
assert.ok(engine.includes("GÜVENLİK HATASI"), "Hash uyuşmazlığı güvenlik hatası üretmiyor");
|
||
assert.ok(engine.includes("sha256_file"), "Hash hesaplama fonksiyonu yok");
|
||
assert.ok(
|
||
engine.indexOf("sha256_file(&path)") < engine.indexOf("let args = build_spoofdpi_args"),
|
||
"Spawn öncesi tekrar doğrulama yok"
|
||
);
|
||
|
||
const rustFiles = [];
|
||
const walk = (dir) => {
|
||
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
||
const full = path.join(dir, entry.name);
|
||
if (entry.isDirectory()) walk(full);
|
||
else if (entry.name.endsWith(".rs")) rustFiles.push(full);
|
||
}
|
||
};
|
||
walk(path.join(ROOT, "src-tauri", "src"));
|
||
rustFiles.push(path.join(ROOT, "src-tauri", "build.rs"));
|
||
for (const file of rustFiles) {
|
||
const source = fs.readFileSync(file, "utf8");
|
||
assert.ok(!/\.unwrap\(\)/.test(source), `${path.basename(file)}: .unwrap() kaldı`);
|
||
assert.ok(!/\.expect\(/.test(source), `${path.basename(file)}: .expect() kaldı`);
|
||
assert.ok(!/cmd\.exe|powershell(\.exe)?\s/i.test(source), `${path.basename(file)}: shell çağrısı var`);
|
||
}
|
||
});
|
||
|
||
await runTest("15. PAC istek limiti + peer filtresi + loopback", async () => {
|
||
const pac = read("src-tauri/src/pac_server.rs");
|
||
assert.ok(pac.includes("MAX_REQUEST_BYTES: usize = 4096"), "4 KB istek sınırı yok");
|
||
assert.ok(pac.includes("READ_TIMEOUT: Duration = Duration::from_secs(5)"), "5 sn okuma zaman aşımı yok");
|
||
assert.ok(pac.includes("is_allowed_peer"), "RFC1918 peer filtresi yok");
|
||
assert.ok(pac.includes("413"), "Aşırı istek 413 döndürmüyor");
|
||
assert.ok(pac.includes("408"), "Zaman aşımı 408 döndürmüyor");
|
||
assert.ok(pac.includes('if allow_lan { "0.0.0.0" } else { "127.0.0.1" }'), "Koşullu LAN bind yok");
|
||
const lib = read("src-tauri/src/lib.rs");
|
||
assert.ok(lib.includes("app_config.lan_sharing = false"), "Açılışta LAN zorla kapatılmıyor");
|
||
assert.ok(lib.includes("if !lan_allowed"), "LAN izin parametresi doğrulanmıyor");
|
||
assert.ok(lib.includes("0.0.0.0"), "LAN bind mantığı yok");
|
||
});
|
||
|
||
await runTest("16. CSP, sıfır capability ve panic fail-safe", async () => {
|
||
const conf = JSON.parse(read("src-tauri/tauri.conf.json"));
|
||
assert.equal(
|
||
conf.app.security.csp,
|
||
"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' ipc: http://ipc.localhost"
|
||
);
|
||
const cap = JSON.parse(read("src-tauri/capabilities/default.json"));
|
||
assert.deepEqual(cap.permissions, [], "Webview'e gereksiz izin verilmiş");
|
||
const lib = read("src-tauri/src/lib.rs");
|
||
assert.ok(lib.includes("set_hook"), "Panic hook yok");
|
||
assert.ok(lib.includes("restore_system_proxy(true)"), "Panikte proxy geri yükleme yok");
|
||
assert.ok(lib.includes("CHILD_PID"), "Panikte motor PID takibi yok");
|
||
const config = read("src-tauri/src/config.rs");
|
||
assert.ok(config.includes("deny_unknown_fields"), "Config şema doğrulaması yok");
|
||
assert.ok(config.includes("64 * 1024"), "Config boyut sınırı yok");
|
||
});
|
||
|
||
await runTest("17. Eduroam modu: SSID, 802.1X, MTU 1400, PAC DIRECT", async () => {
|
||
const eduroam = read("src-tauri/src/eduroam.rs");
|
||
assert.ok(eduroam.includes("wlan"), "Wi-Fi SSID tespiti yok");
|
||
assert.ok(eduroam.includes("eduroam"), "eduroam eşleşmesi yok");
|
||
assert.ok(eduroam.includes("EDUROAM_MTU: u16 = 1400"), "MTU 1400 sabiti yok");
|
||
assert.ok(eduroam.includes("current_mtu"), "MTU okuma yok");
|
||
assert.ok(eduroam.includes("restore_mtu"), "MTU geri yükleme yok");
|
||
assert.ok(eduroam.includes("ms-settings:network-wifi"), "Wi-Fi ayarları açılmıyor");
|
||
assert.ok(eduroam.includes("udp_stun_probe"), "UDP/Ses tanılaması yok");
|
||
|
||
const lib = read("src-tauri/src/lib.rs");
|
||
assert.ok(lib.includes("pub mod eduroam"), "Eduroam modülü bağlı değil");
|
||
assert.ok(lib.includes("get_eduroam_status"), "Eduroam durum komutu yok");
|
||
assert.ok(lib.includes("run_eduroam_diagnostics"), "Eduroam tanılama komutu yok");
|
||
assert.ok(lib.includes("spawn_blocking(eduroam::status)"), "SSID/MTU komutu UI'yı blokluyor");
|
||
assert.ok(lib.includes("spawn_blocking(eduroam::connect_wifi)"), "Wi-Fi bağlanma komutu UI'yı blokluyor");
|
||
assert.ok(lib.includes('"eduroam"'), "Eduroam çalışma modu doğrulanmıyor");
|
||
assert.ok(lib.includes("is_system_wide"), "Eduroam WinHTTP kapsamına alınmamış");
|
||
assert.ok(lib.includes("restore_from_backup"), "MTU çökme kurtarması yok");
|
||
|
||
const config = read("src-tauri/src/config.rs");
|
||
assert.ok(config.includes('"eduroam"'), "Config eduroam modunu normalize etmiyor");
|
||
|
||
const app = read("src/App.jsx");
|
||
assert.ok(app.includes("GraduationCap"), "Eduroam ikonu arayüzde yok");
|
||
assert.ok(app.includes("get_eduroam_status"), "Arayüz Eduroam durumunu okumuyor");
|
||
assert.ok(app.includes("run_eduroam_diagnostics"), "Arayüz ağ testini çalıştırmıyor");
|
||
assert.ok(app.includes("voiceWarning"), "Ses UDP uyarısı yok");
|
||
assert.ok(app.includes("!uiActive"), "Gizli pencerede Eduroam yoklaması durmuyor");
|
||
const i18n = read("src/i18n.js");
|
||
assert.ok(i18n.includes("Eduroam Modu"), "Türkçe Eduroam metni yok");
|
||
});
|
||
|
||
await runTest("18. Ultra-low latency: Smart DoH, TCP_NODELAY, öncelik, LTO", async () => {
|
||
const cargo = read("src-tauri/Cargo.toml");
|
||
assert.ok(cargo.includes("lto = \"fat\""), "LTO fat yok");
|
||
assert.ok(cargo.includes("codegen-units = 1"), "codegen-units=1 yok");
|
||
assert.ok(cargo.includes("panic = \"abort\""), "panic=abort yok");
|
||
assert.ok(cargo.includes("strip = true"), "strip=true yok");
|
||
|
||
const engine = read("src-tauri/src/engine.rs");
|
||
assert.ok(engine.includes("select_fastest_doh"), "Smart DoH seçici yok");
|
||
assert.ok(engine.includes("probe_median"), "3'lü medyan ölçümü yok");
|
||
assert.ok(engine.includes("ABOVE_NORMAL_PRIORITY_CLASS"), "Süreç önceliği yok");
|
||
assert.ok(engine.includes("probe_local_port"), "Yerel soket canlılık testi yok");
|
||
|
||
const pac = read("src-tauri/src/pac_server.rs");
|
||
assert.ok(pac.includes("set_nodelay(true)"), "PAC TCP_NODELAY yok");
|
||
assert.ok(pac.includes("Cache-Control: public, max-age=3600"), "PAC önbellek başlığı yok");
|
||
|
||
const lib = read("src-tauri/src/lib.rs");
|
||
assert.ok(lib.includes("transition_guard"), "Race-condition geçiş kilidi yok");
|
||
assert.ok(lib.includes("probe_local_port"), "Supervisor soket yoklaması yok");
|
||
assert.ok(lib.includes("resolve_engine_doh"), "Auto DoH çözümlemesi bağlı değil");
|
||
|
||
const app = read("src/App.jsx");
|
||
assert.ok(app.includes("slice(-149)"), "Log ring buffer 150 değil");
|
||
assert.ok(app.includes("uiActive"), "Tray gizliyken zamanlayıcı duraklatılmıyor");
|
||
assert.ok(app.includes("setInterval"), "Durum zamanlayıcısı yok");
|
||
});
|
||
|
||
await runTest("19. Sürüm 1.5.10 tutarlı", async () => {
|
||
const pkg = JSON.parse(read("package.json"));
|
||
const cargo = read("src-tauri/Cargo.toml");
|
||
const conf = JSON.parse(read("src-tauri/tauri.conf.json"));
|
||
assert.equal(pkg.version, "1.5.10");
|
||
assert.equal(conf.version, "1.5.10");
|
||
assert.match(cargo, /^version = "1\.5\.10"/m);
|
||
});
|
||
|
||
await runTest("20. Yeni logo: app-icon, public logo, favicon ve arayüz", async () => {
|
||
const pngSize = (file) => {
|
||
const buffer = fs.readFileSync(file);
|
||
assert.equal(buffer.subarray(0, 8).toString("hex"), "89504e470d0a1a0a");
|
||
return { width: buffer.readUInt32BE(16), height: buffer.readUInt32BE(20) };
|
||
};
|
||
assert.ok(fs.existsSync(path.join(ROOT, "assets", "branding", "ld-fdpi-logo-source.png")));
|
||
const appIcon = pngSize(path.join(ROOT, "app-icon.png"));
|
||
assert.deepEqual(appIcon, { width: 1024, height: 1024 });
|
||
const uiLogo = pngSize(path.join(ROOT, "public", "logo.png"));
|
||
assert.deepEqual(uiLogo, { width: 512, height: 512 });
|
||
const app = read("src/App.jsx");
|
||
assert.ok(app.includes('src="/logo.png"'), "Arayüz yeni PNG logoyu kullanmıyor");
|
||
assert.ok(!app.includes("logo.svg"), "Arayüz eski SVG logoyu kullanıyor");
|
||
const html = read("index.html");
|
||
assert.ok(html.includes('href="/logo.png"'), "Favicon yeni logoyu kullanmıyor");
|
||
assert.ok(fs.statSync(path.join(ROOT, "src-tauri", "icons", "icon.ico")).size > 1000);
|
||
});
|
||
|
||
await runTest("21. Captive portal asistanı bağlı", async () => {
|
||
const captive = read("src-tauri/src/captive.rs");
|
||
assert.match(captive, /pub fn connect_without_login/);
|
||
assert.match(captive, /discover_portal/);
|
||
assert.match(captive, /valid_portal_url/);
|
||
const lib = read("src-tauri/src/lib.rs");
|
||
assert.match(lib, /pub mod captive;/);
|
||
assert.match(lib, /connect_without_login/);
|
||
const app = read("src/App.jsx");
|
||
assert.match(app, /handleCaptiveConnect/);
|
||
assert.match(app, /connect_without_login/);
|
||
const i18n = read("src/i18n.js");
|
||
assert.match(i18n, /Oturum Açmadan Bağlantı/);
|
||
assert.match(i18n, /Connect Without Login/);
|
||
});
|
||
|
||
console.log("\n==============================================================");
|
||
console.log(`SONUÇ: ${passed} başarılı, ${failed} başarısız`);
|
||
console.log("==============================================================");
|
||
if (failed > 0) process.exit(1);
|