MEMORY.md — balancer-lite-lua
Project
- Type: Thin-layer Lua 5.1 port of balancer-lite for OpenWrt 22.03
- Goal: Add hysteresis/flap watchdog + signed webhook outbox + retention store + WG endpoint re-point on top of mwan3/netifd
- Repo: git3:git3.techno-world.net/lrosales/balancer-lite-lua.git
Key Decisions
- Target: OpenWrt 22.03 (Lua 5.1), flash/overlay-persistent state at /root/.balancerlite/
- Pure-Lua crypto avoided; use
openssl dgst (openssl-util package on OpenWrt)
- Probes via subprocess:
ping, nc, nslookup; no raw sockets
- JSONL append-only store + periodic compaction; no BoltDB/SQLite dependency
- Procd init (not systemd); UCI config (not YAML)
State Machine (8 states)
INIT, WAN_A_PRIMARY, WAN_B_PRIMARY, SWITCHING_TO_A, SWITCHING_TO_B,
DEGRADED, BOTH_DOWN — verified against Go source.
Constraints
- Lua 5.1: no table.pack/move, no goto, no //, no math.type, no bitwise operators
- /var is tmpfs; persistent state must go under /overlay (/root, /etc, /mnt)
- No lua-crypto; HMAC via openssl CLI