90 lines
4.9 KiB
Markdown
90 lines
4.9 KiB
Markdown
# Lostcave Wireplanner
|
|
|
|
Network mapping and cable management tool — no auto-discovery, no SNMP, no bullshit.
|
|
Manual data entry with a dark web UI. Think of it as a whiteboard that doesn't smudge.
|
|
|
|
## Stack
|
|
|
|
| Layer | Choice |
|
|
|-----------|---------------------------------------|
|
|
| Language | Go 1.22+ |
|
|
| HTTP | `net/http` stdlib (1.22 pattern routing) |
|
|
| Templates | `html/template` |
|
|
| Frontend | HTMX 2.0 (self-hosted), vanilla CSS, vanilla JS |
|
|
| Database | SQLite 3 (WAL mode, single-file) |
|
|
|
|
Zero build steps. `go build` → one binary. Drop it on a server and go.
|
|
|
|
## Quick start
|
|
|
|
```sh
|
|
git clone <repo>
|
|
cd lostcavewireplanner
|
|
go build -o wireplanner .
|
|
./wireplanner
|
|
# → http://localhost:8080
|
|
```
|
|
|
|
Set `PORT=9090` to change the listen port. Database is created as `data.db` in the working directory.
|
|
|
|
## Features
|
|
|
|
### Views
|
|
- **Overview** — landing page with all racks, unracked devices, global connection table. Create racks and devices inline. Rack cards show device counts.
|
|
- **Rack view** — front/back rack table (U1 at bottom to U42+ at top). Devices placed at specific rack units with continuous background tint for multi-U devices. Clickable ports show connection status with per-cable colors.
|
|
- **Device view** — model info, usage description, location, front/back port lists. Embedded model images. Back-to-rack breadcrumb link when racked.
|
|
- **Device models** — create/edit templates with rack-mountable flag, height in U, patch panel, wall socket, and power strip checkboxes. Arbitrary port definitions (name + front/back side). Port side selectors auto-disable for patch panels. **Clone button** to copy models with all ports.
|
|
- **Wall sockets** — table view with location, type, name, comment. Clickable ports for connection inspection.
|
|
- **Connection modal** (HTMX) — click any port to inspect its cable. Full trace through patch panels and wall sockets. Show/hide connection type, color, per-end labels, and endpoint devices. Create, edit, and delete connections inline.
|
|
|
|
### Connection tracing
|
|
Cables are traced through patch panels automatically. If you click a port on a switch connected to a patch panel that's patched through to a wall socket that leads to an access point, the modal shows the full chain:
|
|
|
|
`Switch [g01] ==(cable label)==> [Patch Panel / p01 front] → [pp01 back] ==(another cable)==> [Wall Socket] ==>(cable)==> [Access Point]`
|
|
|
|
### Click-to-connect mode
|
|
Toggle "Connect Mode" on any rack or device view. Click one port (it glows), click another port, a mini form pops up to choose type/color/labels. Create the cable in two clicks — no dropdown scrolling.
|
|
|
|
### Power strips
|
|
Mark a device model as a power strip. In the rack view it renders as a grid of 🔌 outlet sockets. Each outlet shows its label and whether something is plugged into it, color-coded by the power cable's color.
|
|
|
|
### Data model
|
|
Assigned numeric IDs per type (racks, devices, ports, connections). Names are mutable — IDs are the canonical reference.
|
|
|
|
| Table | Purpose |
|
|
|------------------|---------------------------------------------------|
|
|
| `device_models` | Templates (switch 48-port, patch panel 24, etc.) |
|
|
| `device_model_ports` | Port definitions on models |
|
|
| `racks` | Physical racks (type, depth, height in U) |
|
|
| `devices` | Actual devices (racked or unracked, rack position) |
|
|
| `device_ports` | Instantiated ports on actual devices |
|
|
| `connection_types`| Ethernet, FibreChannel, SAS, power, video, audio, serial, USB |
|
|
| `connections` | Cables (two port ends, labels, color) |
|
|
|
|
Patch panels and wall sockets auto-double ports: every model port gets both a front and back instance with the same name, allowing the tracer to follow through.
|
|
|
|
### Transactions
|
|
All writes use SQLite transactions. A port can only have one cable. Dangling cables are allowed (one end only, not both). Duplicate name errors are caught and shown as friendly messages.
|
|
|
|
## Project layout
|
|
|
|
```
|
|
├── main.go # Routes and entry point
|
|
├── internal/
|
|
│ ├── db/ # Schema, migrations, Store (CRUD)
|
|
│ ├── handlers/ # HTTP handlers per domain
|
|
│ ├── models/ # Go structs
|
|
│ └── services/ # Connection tracing logic
|
|
├── templates/ # Go HTML templates (one per page + shared partials)
|
|
├── static/
|
|
│ ├── style.css # Dark theme, single file
|
|
│ ├── js/
|
|
│ │ ├── htmx.min.js # HTMX 2.0 (self-hosted, no CDN)
|
|
│ │ └── app.js # Modal management, connect mode
|
|
└── uploads/ # Device model images (runtime, .gitignored)
|
|
```
|
|
|
|
## License
|
|
|
|
GNU Affero General Public License v3.0 or later. See [LICENSE](LICENSE).
|