|
|
@@ -8,10 +8,10 @@ balancer-lite's hysteresis watchdog, flap detection, signed webhook outbox, and
|
|
|
Thin-layer only (~800–1000 LOC) — composes with mwan3/netifd rather than replacing them.
|
|
|
|
|
|
### Commit
|
|
|
-Not yet committed (pending lint).
|
|
|
+`09fad45` — "Initial Lua 5.1 prototype for OpenWrt 22.03"
|
|
|
|
|
|
### Files
|
|
|
-- `src/balancerlite/state.lua` — 8-state hysteresis machine (INIT, WAN_A_PRIMARY, WAN_B_PRIMARY, SWITCHING_TO_A, SWITCHING_TO_B, DEGRADED, BOTH_DOWN)
|
|
|
+- `src/balancerlite/state.lua` — 8-state hysteresis machine (INIT, WAN_A/B_PRIMARY, SWITCHING_TO_A/B, DEGRADED, BOTH_DOWN)
|
|
|
- `src/balancerlite/probes.lua` — ICMP/TCP/DNS health checks via ping/nc/nslookup subprocesses
|
|
|
- `src/balancerlite/store.lua` — JSONL append-only event log + compaction
|
|
|
- `src/balancerlite/outbox.lua` — Signed webhook retry queue with exponential backoff + circuit breaker
|
|
|
@@ -31,25 +31,32 @@ Not yet committed (pending lint).
|
|
|
lua5.1 tests/state.lua → PASS: state (8/8 tests)
|
|
|
lua5.1 tests/sha256.lua → PASS: sha256 (3/3 vectors)
|
|
|
```
|
|
|
+All modules pass `luac5.1 -p` (parse check).
|
|
|
|
|
|
### Verification Commands
|
|
|
```sh
|
|
|
cd /root/.openclaw/workspace/balancer-lite-lua
|
|
|
-make test
|
|
|
-make lint
|
|
|
+make test # runs all tests
|
|
|
+make lint # runs luac5.1 -p on all modules
|
|
|
```
|
|
|
|
|
|
+### Remote
|
|
|
+`https://git3.techno-world.net/lrosales/balancer-lite-lua.git`
|
|
|
+⚠️ Repo does not exist yet on git3 — creation via Gogs API returned 401.
|
|
|
+Manual repo creation needed on https://git3.techno-world.net first.
|
|
|
+
|
|
|
### Notes
|
|
|
- HMAC-SHA256 uses `openssl dgst -hmac` CLI (openssl-util package on OpenWrt 22.03)
|
|
|
- No lua-crypto dependency; no raw sockets; all probes via subprocess
|
|
|
-- State machine behavior verified against Go source: 8 states, same transition logic
|
|
|
-- SWITCHING_TO_* are intermediate (one-drive-cycle) states; BOTH_DOWN transitions directly to stable primary (no intermediate)
|
|
|
+- State machine verified against Go source: 8 states, same transition logic
|
|
|
+- SWITCHING_TO_* are one-drive-cycle intermediate states
|
|
|
+- BOTH_DOWN transitions directly to stable primary (no intermediate)
|
|
|
- BOTH_DOWN clears switch_times (flap detection not counted during all-down)
|
|
|
-- DEGRADED entry: flap check counts #record_switch calls; needs `flap_threshold` of them before DEGRADED triggers
|
|
|
-
|
|
|
-### Next Steps
|
|
|
-1. Run lua51-openwrt-lint on all modules
|
|
|
-2. Run openwrt-testbed for runtime validation
|
|
|
-3. Write remaining modules: routing.lua (policy routing), wg.lua (WG endpoint re-point)
|
|
|
-4. Write balancerlite-ctl CLI tool
|
|
|
-5. Commit and push to git3
|
|
|
+- DEGRADED entry: flap check counts #record_switch calls; needs `flap_threshold` of them
|
|
|
+
|
|
|
+### Remaining Work
|
|
|
+1. Create empty repo on git3.techno-world.net, then `git push -u origin master`
|
|
|
+2. Write `src/balancerlite/routing.lua` (policy routing via `ip` commands)
|
|
|
+3. Write `src/balancerlite/wg.lua` (WireGuard endpoint re-point via `wg set`)
|
|
|
+4. Write `balancerlite-ctl` CLI tool (status/events/switch/compact)
|
|
|
+5. Runtime test on `openwrt-testbed`
|