Scaffold ipswap: tray-driven Windows IP preset switcher

Implements the design in claude.md as a building skeleton: pure Go, no cgo,
cross-compiles to a single Windows .exe from Linux.

Architecture follows the spec's deliberate split. The fast path is native —
tray icon, grouped submenus, a Win32 MessageBox showing a live before/after
diff, then netsh. The slow path is an embedded web editor served on a random
loopback port and opened in the default browser.

Two decisions worth recording:

Reads use GetAdaptersAddresses, writes use netsh. The spec left the
enumeration mechanism open; parsing `netsh show config` breaks on a
non-English Windows because the output is localised. DNS static-vs-DHCP
origin is not exposed by that API, so it comes from one registry read.

The netsh command plan is built in portable code. That puts the delete-every-
existing-address step — the one that stops secondary addresses leaking across
switches — under test without needing a Windows box.

The editor requires the session token in a header for mutations, not just the
cookie: any page in the browser can make it POST to 127.0.0.1 with the cookie
attached, but it cannot set a header. The updater refuses to install a release
that publishes no SHA256.

Not yet done: no group picker for export (the API supports it), no
single-instance guard, and internal/server/web/app.css is reconstructed from
the description in claude.md rather than the canonical apointless.css.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-20 13:29:35 +10:00
commit 23dcfb393f
46 changed files with 5782 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
{
"version": 1,
"presets": [
{
"id": "0198f2a1c4d07f3b2e5a9c81",
"name": "Artist frame — control",
"group": "Riedel",
"adapter": "Ethernet",
"mode": "static",
"primary": {
"address": "192.168.42.100",
"prefix": 24,
"gateway": "192.168.42.1"
},
"secondary": [
{ "address": "10.0.10.50", "prefix": 24 }
],
"dns": {
"mode": "static",
"servers": ["192.168.42.1", "1.1.1.1"]
},
"notes": "Frame A, rack 3"
},
{
"id": "0198f2a1c4d17a9e4b02d135",
"name": "Artist frame — media",
"group": "Riedel",
"adapter": "Ethernet",
"mode": "static",
"primary": {
"address": "10.20.0.100",
"prefix": 16
},
"dns": { "mode": "dhcp" },
"notes": "No gateway: media VLAN is deliberately non-routed"
},
{
"id": "0198f2a1c4d2b60c7f318ea4",
"name": "Management VLAN",
"group": "Herespace",
"adapter": "Ethernet",
"mode": "static",
"primary": {
"address": "172.16.5.200",
"prefix": 24,
"gateway": "172.16.5.1",
"gateway_metric": 10
},
"dns": {
"mode": "static",
"servers": ["172.16.5.10"]
}
},
{
"id": "0198f2a1c4d3e8175c60ba92",
"name": "DHCP",
"group": "General",
"adapter": "Ethernet",
"mode": "dhcp",
"dns": { "mode": "dhcp" }
},
{
"id": "0198f2a1c4d4fa38096c2d7e",
"name": "Wi-Fi — DHCP",
"group": "General",
"adapter": "Wi-Fi",
"mode": "dhcp",
"dns": { "mode": "dhcp" },
"notes": "Wi-Fi adapters are treated identically to wired ones"
}
]
}