ci / check (push) Successful in 6m6s
- internal/jsjson: JSON.stringify-compatible encoder and order-preserving decoder, tested against fixtures produced by Node itself - internal/ctrl: awg-ctrl in Go (params, vpn:// keys, users, peers, sync, 3.1 upgrade, CAKE shaping, metrics, monitor job, Express-compatible HTTP layer) - internal/iauth, internal/logx: internal Ed25519 tokens and logging - tools/diffbench: Docker bench with stubbed awg/ip/tc/nft that runs one scenario against the TS and Go implementations for comparison Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
// Состояние после сценария: conf, файлы каталога, строки баз, журнал и состояние заглушек.
|
|
import fs from "fs";
|
|
import { execSync } from "child_process";
|
|
const out = process.argv[2];
|
|
const t = JSON.parse(fs.readFileSync(out, "utf8"));
|
|
const D = "/etc/amnezia/amneziawg";
|
|
const q = sql => JSON.parse(execSync(`sqlite3 -json ${D}/users.db "${sql}"`).toString() || "[]");
|
|
t.state = {
|
|
conf: fs.readFileSync(`${D}/awg1.conf`, "utf8"),
|
|
confMode: (fs.statSync(`${D}/awg1.conf`).mode & 0o777).toString(8),
|
|
files: fs.readdirSync(D).map(f => f.replace(/\d{4}-\d\d-\d\dT[\d-]+Z/, "<ts>")).sort(),
|
|
users: q("select * from users order by rowid"),
|
|
peers: q("select * from peers order by rowid"),
|
|
config: q("select * from config order by key"),
|
|
schema: execSync(`sqlite3 ${D}/users.db .schema`).toString(),
|
|
stubLog: fs.readFileSync("/var/lib/stub/log.jsonl", "utf8").split("\n").filter(Boolean).map(l => JSON.parse(l)),
|
|
stubState: JSON.parse(fs.readFileSync("/var/lib/stub/state.json", "utf8")),
|
|
};
|
|
fs.writeFileSync(out, JSON.stringify(t, null, 1));
|
|
console.log(`collect: done`);
|